﻿--变量
local id = 1;
local _G = _G;
local rl = "";

--设置面板
UnitFramesPlus_OptionsFrame = CreateFrame("Frame", "UnitFramesPlus_OptionsFrame", UIParent);
UnitFramesPlus_OptionsFrame.name = "UnitFramesPlus";
InterfaceOptions_AddCategory(UnitFramesPlus_OptionsFrame);
UnitFramesPlus_OptionsFrame:SetScript("OnShow", function()
    UnitFramesPlus_OptionPanel_OnShow();
end)

--快速焦点快捷键下拉菜单
local QuickFocusDropDown = {"alt", "shift", "ctrl"};
local function QuickFocus_OnClick(self)
    UIDropDownMenu_SetSelectedID(UnitFramesPlus_OptionsFrame_FocusQuickDropDown, self:GetID());
    UnitFramesPlus_FocusQuickClear(QuickFocusDropDown[UnitFramesPlusDB["focus"]["button"]]);
    UnitFramesPlusDB["focus"]["button"] = self:GetID();
    UnitFramesPlus_FocusQuick();
end
local function QuickFocus_Init()
    local info, text, func;
    for id = 1, 3, 1 do
        info = {
            text = QuickFocusDropDown[id];
            func = QuickFocus_OnClick;
        };
        UIDropDownMenu_AddButton(info);
    end
end

--边框类型下拉菜单
local PlayerExtBorderTypeDropDown = {UFP_OP_Player_Elite, UFP_OP_Player_RareElite, UFP_OP_Player_Rare};
local function PlayerExtBorderType_OnClick(self)
    UIDropDownMenu_SetSelectedID(UnitFramesPlus_OptionsFrame_PlayerExtBorderType, self:GetID());
    UnitFramesPlusDB["player"]["raretype"] = self:GetID();
    UnitFramesPlus_PlayerDragon();
end
local function PlayerExtBorderType_Init()
    local info, text, func;
    for id = 1, 3, 1 do
        info = {
            text = PlayerExtBorderTypeDropDown[id];
            func = PlayerExtBorderType_OnClick;
        };
        UIDropDownMenu_AddButton(info);
    end
end

--生命值/法力值/百分比下拉菜单
local PlayerHPMPPctDropDown = {UFP_OP_Player_NumCur, UFP_OP_Player_NumMax, UFP_OP_Player_Pct, UFP_OP_Player_None};
local function PlayerHPMPPctPartOne_OnClick(self)
    UIDropDownMenu_SetSelectedID(UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartOne, self:GetID());
    UnitFramesPlusDB["player"]["hpmppartone"] = self:GetID();
    UnitFramesPlus_PlayerHPValueDisplayUpdate();
    UnitFramesPlus_PlayerMPValueDisplayUpdate();
end
local function PlayerHPMPPctPartOne_Init()
    local info, text, func;
    for id = 1, 3, 1 do
        info = {
            text = PlayerHPMPPctDropDown[id];
            func = PlayerHPMPPctPartOne_OnClick;
        };
        UIDropDownMenu_AddButton(info);
    end
end
local function PlayerHPMPPctPartTwo_OnClick(self)
    UIDropDownMenu_SetSelectedID(UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartTwo, self:GetID());
    UnitFramesPlusDB["player"]["hpmpparttwo"] = self:GetID();
    UnitFramesPlus_PlayerHPValueDisplayUpdate();
    UnitFramesPlus_PlayerMPValueDisplayUpdate();
end
local function PlayerHPMPPctPartTwo_Init()
    local info, text, func;
    for id = 1, 4, 1 do
        info = {
            text = PlayerHPMPPctDropDown[id];
            func = PlayerHPMPPctPartTwo_OnClick;
        };
        UIDropDownMenu_AddButton(info);
    end
end

StaticPopupDialogs["UFP_MOUSESHOW"] = {
    text = UFP_OP_Mouseshow_info,
    button1 = TEXT(ACCEPT),
    button2 = TEXT(CANCEL),
    OnAccept = function()
        InterfaceOptionsFrame:Hide();
        GameMenuButtonUIOptions:Click();
        InterfaceOptionsFrameCategoriesButton3:Click();
    end,
    timeout = 0,
    hideOnEscape = 1,
    exclusive = 1,
    whileDead = 1,
    preferredIndex = 3,
}

StaticPopupDialogs["UFP_RELOADUI"] = {
    text = UFP_OP_Reload_info,
    button1 = TEXT(ACCEPT),
    button2 = TEXT(CANCEL),
    OnAccept = function()
        if rl == "origin" then
            UnitFramesPlusDB["party"]["origin"] = 1 - UnitFramesPlusDB["party"]["origin"];
            if tonumber(GetCVar("useCompactPartyFrames")) == UnitFramesPlusDB["party"]["origin"] then
                CompactUnitFrameProfilesRaidStylePartyFrames:Click();
            end
        end
        ReloadUI();
    end,
    timeout = 0,
    hideOnEscape = 1,
    exclusive = 1,
    whileDead = 1,
    preferredIndex = 3,
}

do
    --插件介绍
    local info = UnitFramesPlus_OptionsFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge");
    info:SetPoint("TOPLEFT", 16, -16);
    info:SetText("UnitFramesPlus v"..GetAddOnMetadata("UnitFramesPlus", "Version"));

    local infotext = UnitFramesPlus_OptionsFrame:CreateFontString(nil, "ARTWORK", "GameFontNormal");
    infotext:SetPoint("TOPLEFT", info, "TOPLEFT", 0, -40);
    infotext:SetTextColor(1, 1, 1);
    infotext:SetText(UFP_OP_InfoText);

    local infotext2 = UnitFramesPlus_OptionsFrame:CreateFontString(nil, "ARTWORK", "GameFontNormal");
    infotext2:SetPoint("TOPLEFT", infotext, "TOPLEFT", 0, -30);
    infotext2:SetTextColor(1, 1, 1);
    infotext2:SetText(UFP_OP_InfoText2);

    local infotext3 = UnitFramesPlus_OptionsFrame:CreateFontString(nil, "ARTWORK", "GameFontNormal");
    infotext3:SetPoint("TOPLEFT", infotext2, "TOPLEFT", 0, -40);
    infotext3:SetTextColor(1, 1, 1);
    infotext3:SetText(UFP_OP_InfoText3);

    --全局设置菜单
    local UnitFramesPlus_Global_Options = CreateFrame("Frame", "UnitFramesPlus_Global_Options", UIParent);
    UnitFramesPlus_Global_Options.name = UFP_OP_Global_Options;
    UnitFramesPlus_Global_Options.parent = "UnitFramesPlus";
    UnitFramesPlus_Global_Options:Hide();
    InterfaceOptions_AddCategory(UnitFramesPlus_Global_Options);

    --玩家设置菜单
    local UnitFramesPlus_Player_Options = CreateFrame("Frame", "UnitFramesPlus_Player_Options", UIParent);
    UnitFramesPlus_Player_Options.name = UFP_OP_Player_Options;
    UnitFramesPlus_Player_Options.parent = "UnitFramesPlus";
    UnitFramesPlus_Player_Options:Hide();
    InterfaceOptions_AddCategory(UnitFramesPlus_Player_Options);

    --玩家宠物设置菜单
    local UnitFramesPlus_Pet_Options = CreateFrame("Frame", "UnitFramesPlus_Pet_Options", UIParent);
    UnitFramesPlus_Pet_Options.name = UFP_OP_Pet_Options;
    UnitFramesPlus_Pet_Options.parent = "UnitFramesPlus";
    UnitFramesPlus_Pet_Options:Hide();
    InterfaceOptions_AddCategory(UnitFramesPlus_Pet_Options);

    --目标设置菜单
    local UnitFramesPlus_Target_Options = CreateFrame("Frame", "UnitFramesPlus_Target_Options", UIParent);
    UnitFramesPlus_Target_Options.name = UFP_OP_Target_Options;
    UnitFramesPlus_Target_Options.parent = "UnitFramesPlus";
    UnitFramesPlus_Target_Options:Hide();
    InterfaceOptions_AddCategory(UnitFramesPlus_Target_Options);

    --目标的目标设置菜单
    local UnitFramesPlus_TargetTarget_Options = CreateFrame("Frame", "UnitFramesPlus_TargetTarget_Options", UIParent);
    UnitFramesPlus_TargetTarget_Options.name = UFP_OP_ToT_Options;
    UnitFramesPlus_TargetTarget_Options.parent = "UnitFramesPlus";
    UnitFramesPlus_TargetTarget_Options:Hide();
    InterfaceOptions_AddCategory(UnitFramesPlus_TargetTarget_Options);

    --焦点设置菜单
    local UnitFramesPlus_Focus_Options = CreateFrame("Frame", "UnitFramesPlus_Focus_Options", UIParent);
    UnitFramesPlus_Focus_Options.name = UFP_OP_Focus_Options;
    UnitFramesPlus_Focus_Options.parent = "UnitFramesPlus";
    UnitFramesPlus_Focus_Options:Hide();
    InterfaceOptions_AddCategory(UnitFramesPlus_Focus_Options);

    --队友设置菜单
    local UnitFramesPlus_Party_Options = CreateFrame("Frame", "UnitFramesPlus_Party_Options", UIParent);
    UnitFramesPlus_Party_Options.name = UFP_OP_Party_Options;
    UnitFramesPlus_Party_Options.parent = "UnitFramesPlus";
    UnitFramesPlus_Party_Options:Hide();
    InterfaceOptions_AddCategory(UnitFramesPlus_Party_Options);

    --全局设定
    local globalconfig = UnitFramesPlus_Global_Options:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge");
    globalconfig:SetPoint("TOPLEFT", 16, -16);
    globalconfig:SetText(UFP_OP_Global_Options);

    --恢复默认设置
    local UnitFramesPlus_OptionsFrame_Reset = CreateFrame("Button", "UnitFramesPlus_OptionsFrame_Reset", UnitFramesPlus_Global_Options, "OptionsButtonTemplate");
    UnitFramesPlus_OptionsFrame_Reset:SetPoint("TOPLEFT", globalconfig, "TOPLEFT", 2, -40);
    UnitFramesPlus_OptionsFrame_Reset:SetWidth(154);
    UnitFramesPlus_OptionsFrame_Reset:SetHeight(25);
    UnitFramesPlus_OptionsFrame_ResetText:SetText(UFP_OP_Reset);
    UnitFramesPlus_OptionsFrame_Reset:SetScript("OnClick", function(self)
        UnitFramesPlusDB["reset"] = 1;
        StaticPopup_Show("UFP_RELOADUI");
    end)

    --地图设置按钮
    local UnitFramesPlus_OptionsFrame_MinimapButton = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_MinimapButton", UnitFramesPlus_Global_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_MinimapButton:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_Reset, "TOPLEFT", -2, -35);
    UnitFramesPlus_OptionsFrame_MinimapButton:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_MinimapButtonText:SetText(UFP_OP_MinimapButton_Show);
    UnitFramesPlus_OptionsFrame_MinimapButton:SetScript("OnClick", function(self)
        UnitFramesPlusDB["minimap"]["button"] = 1 - UnitFramesPlusDB["minimap"]["button"];
        UnitFramesPlus_MinimapButton();
        self:SetChecked(UnitFramesPlusDB["minimap"]["button"]==1);
    end)

    --系统状态条显示
    local UnitFramesPlus_OptionsFrame_SYSOnBar = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_SYSOnBar", UnitFramesPlus_Global_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_SYSOnBar:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_MinimapButton, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_SYSOnBar:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_SYSOnBarText:SetText(UFP_OP_SYS_OnBar);
    UnitFramesPlus_OptionsFrame_SYSOnBar:SetScript("OnClick", function(self)
        --InterfaceOptionsFrame_OpenToCategory(InterfaceOptionsStatusTextPanel);
        InterfaceOptionsFrame:Hide();
        GameMenuButtonUIOptions:Click();
        InterfaceOptionsFrameCategoriesButton3:Click();
        self:SetChecked(false);
    end)

    --鼠标移过时才显示数值
    local UnitFramesPlus_OptionsFrame_GlobalMouseShow = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_GlobalMouseShow", UnitFramesPlus_Global_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_GlobalMouseShow:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_SYSOnBar, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_GlobalMouseShow:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_GlobalMouseShowText:SetText(UFP_OP_Mouse_Show);
    UnitFramesPlus_OptionsFrame_GlobalMouseShow:SetScript("OnClick", function(self)
        if tonumber(GetCVar("statusText")) ~= 1 then
            StaticPopup_Show("UFP_MOUSESHOW");
            self:SetChecked(UnitFramesPlusDB["global"]["mouseshow"]==1);
            return;
        end
        UnitFramesPlusDB["global"]["mouseshow"] = 1 - UnitFramesPlusDB["global"]["mouseshow"];
        UnitFramesPlusDB["player"]["mouseshow"] = UnitFramesPlusDB["global"]["mouseshow"];
        UnitFramesPlus_PlayerBarTextMouseShow();
        UnitFramesPlus_OptionsFrame_PlayerMouseShow:SetChecked(UnitFramesPlusDB["global"]["mouseshow"]==1);
        UnitFramesPlusDB["pet"]["mouseshow"] = UnitFramesPlusDB["global"]["mouseshow"];
        UnitFramesPlus_PetBarTextMouseShow();
        UnitFramesPlus_OptionsFrame_PetMouseShow:SetChecked(UnitFramesPlusDB["global"]["mouseshow"]==1);
        UnitFramesPlusDB["target"]["mouseshow"] = UnitFramesPlusDB["global"]["mouseshow"];
        UnitFramesPlus_TargetBarTextMouseShow();
        UnitFramesPlus_OptionsFrame_TargetMouseShow:SetChecked(UnitFramesPlusDB["global"]["mouseshow"]==1);
        UnitFramesPlusDB["focus"]["mouseshow"] = UnitFramesPlusDB["global"]["mouseshow"];
        UnitFramesPlus_FocusBarTextMouseShow();
        UnitFramesPlus_OptionsFrame_FocusMouseShow:SetChecked(UnitFramesPlusDB["global"]["mouseshow"]==1);
        UnitFramesPlusDB["party"]["mouseshow"] = UnitFramesPlusDB["global"]["mouseshow"];
        UnitFramesPlus_PartyBarTextMouseShow();
        UnitFramesPlus_OptionsFrame_PartyMouseShow:SetChecked(UnitFramesPlusDB["global"]["mouseshow"]==1);
        self:SetChecked(UnitFramesPlusDB["global"]["mouseshow"]==1);
    end)

    --全局头像类型开关
    local UnitFramesPlus_OptionsFrame_GlobalPortraitType = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_GlobalPortraitType", UnitFramesPlus_Global_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_GlobalPortraitType:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_GlobalMouseShow, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_GlobalPortraitType:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_GlobalPortraitTypeText:SetText(UFP_OP_Portrait);
    UnitFramesPlus_OptionsFrame_GlobalPortraitType:SetScript("OnClick", function(self)
        UnitFramesPlusDB["global"]["portrait"] = 1 - UnitFramesPlusDB["global"]["portrait"];
        if UnitFramesPlusDB["global"]["portrait"] == 1 then
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSlider);
            if UnitFramesPlusDB["global"]["ptype"] == 1 then
                BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG);
                UnitFramesPlus_OptionsFrame_GlobalPortrait3DBGText:SetTextColor(1, 1, 1);
            elseif UnitFramesPlusDB["global"]["ptype"] == 2 then
                BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo);
                UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNoText:SetTextColor(1, 1, 1);
            end
        else
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSlider);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo);
        end

        UnitFramesPlusDB["player"]["portrait"] = UnitFramesPlusDB["global"]["portrait"];
        UnitFramesPlus_OptionsFrame_PlayerPortraitType:SetChecked(UnitFramesPlusDB["global"]["portrait"]==1);
        UnitFramesPlusDB["player"]["ptype"] = UnitFramesPlusDB["global"]["ptype"];
        UnitFramesPlus_OptionsFrame_PlayerPortraitTypeSlider:SetValue(UnitFramesPlusDB["global"]["ptype"]);
        UnitFramesPlusDB["player"]["p3dbg"] = UnitFramesPlusDB["global"]["p3dbg"];
        UnitFramesPlus_PlayerPortrait3DBGDisplayUpdate();
        UnitFramesPlus_OptionsFrame_PlayerPortrait3DBG:SetChecked(UnitFramesPlusDB["global"]["p3dbg"]==1);
        UnitFramesPlus_PlayerPortrait();
        if UnitFramesPlusDB["player"]["portrait"] == 1 then
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_PlayerPortraitTypeSlider);
            if UnitFramesPlusDB["player"]["ptype"] == 1 then
                BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_PlayerPortrait3DBG);
                UnitFramesPlus_OptionsFrame_PlayerPortrait3DBGText:SetTextColor(1, 1, 1);
            end
        else
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_PlayerPortraitTypeSlider);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PlayerPortrait3DBG);
        end

        UnitFramesPlusDB["target"]["portrait"] = UnitFramesPlusDB["global"]["portrait"];
        UnitFramesPlus_OptionsFrame_TargetPortraitType:SetChecked(UnitFramesPlusDB["global"]["portrait"]==1);
        UnitFramesPlusDB["target"]["ptype"] = UnitFramesPlusDB["global"]["ptype"];
        UnitFramesPlus_OptionsFrame_TargetPortraitTypeSlider:SetValue(UnitFramesPlusDB["global"]["ptype"]);
        UnitFramesPlusDB["target"]["p3dbg"] = UnitFramesPlusDB["global"]["p3dbg"];
        UnitFramesPlus_TargetPortrait3DBGDisplayUpdate();
        UnitFramesPlus_OptionsFrame_TargetPortrait3DBG:SetChecked(UnitFramesPlusDB["global"]["p3dbg"]==1);
        UnitFramesPlusDB["target"]["npcno"] = UnitFramesPlusDB["global"]["npcno"];
        UnitFramesPlus_TargetPortraitDisplayUpdate();
        UnitFramesPlus_OptionsFrame_TargetPortraitNPCNo:SetChecked(UnitFramesPlusDB["global"]["npcno"]==1);
        UnitFramesPlus_TargetPortrait();
        if UnitFramesPlusDB["target"]["portrait"] == 1 then
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_TargetPortraitTypeSlider);
            if UnitFramesPlusDB["target"]["ptype"] == 1 then
                BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_TargetPortrait3DBG);
                UnitFramesPlus_OptionsFrame_TargetPortrait3DBGText:SetTextColor(1, 1, 1);
            elseif UnitFramesPlusDB["target"]["ptype"] == 2 then
                BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_TargetPortraitNPCNo);
                UnitFramesPlus_OptionsFrame_TargetPortraitNPCNoText:SetTextColor(1, 1, 1);
            end
        else
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_TargetPortraitTypeSlider);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetPortrait3DBG);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetPortraitNPCNo);
        end

        UnitFramesPlusDB["focus"]["portrait"] = UnitFramesPlusDB["global"]["portrait"];
        UnitFramesPlus_OptionsFrame_FocusPortraitType:SetChecked(UnitFramesPlusDB["global"]["portrait"]==1);
        UnitFramesPlusDB["focus"]["ptype"] = UnitFramesPlusDB["global"]["ptype"];
        UnitFramesPlus_OptionsFrame_FocusPortraitTypeSlider:SetValue(UnitFramesPlusDB["global"]["ptype"]);
        UnitFramesPlusDB["focus"]["p3dbg"] = UnitFramesPlusDB["global"]["p3dbg"];
        UnitFramesPlus_FocusPortrait3DBGDisplayUpdate();
        UnitFramesPlus_OptionsFrame_FocusPortrait3DBG:SetChecked(UnitFramesPlusDB["global"]["p3dbg"]==1);
        UnitFramesPlusDB["focus"]["npcno"] = UnitFramesPlusDB["global"]["npcno"];
        UnitFramesPlus_FocusPortraitDisplayUpdate();
        UnitFramesPlus_OptionsFrame_FocusPortraitNPCNo:SetChecked(UnitFramesPlusDB["global"]["npcno"]==1);
        UnitFramesPlus_FocusPortrait();
        if UnitFramesPlusDB["focus"]["portrait"] == 1 then
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_FocusPortraitTypeSlider);
            if UnitFramesPlusDB["focus"]["ptype"] == 1 then
                BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_FocusPortrait3DBG);
                UnitFramesPlus_OptionsFrame_FocusPortrait3DBGText:SetTextColor(1, 1, 1);
            elseif UnitFramesPlusDB["focus"]["ptype"] == 2 then
                BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_FocusPortraitNPCNo);
                UnitFramesPlus_OptionsFrame_FocusPortraitNPCNoText:SetTextColor(1, 1, 1);
            end
        else
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_FocusPortraitTypeSlider);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_FocusPortrait3DBG);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_FocusPortraitNPCNo);
        end

        self:SetChecked(UnitFramesPlusDB["global"]["portrait"]==1);
    end)

    --全局头像类型
    local UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSlider = CreateFrame("Slider", "UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSlider", UnitFramesPlus_Global_Options, "OptionsSliderTemplate");
    UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSlider:SetWidth(95);
    UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSlider:SetHeight(16);
    UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSlider:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_GlobalPortraitType, "TOPLEFT", 183, 0);
    UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSliderLow:SetText(UFP_OP_3D);
    UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSliderHigh:SetText(UFP_OP_CLASS);
    UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSlider:SetMinMaxValues(1,2);
    UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSlider:SetValueStep(1);
    UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSlider:SetObeyStepOnDrag(true);
    UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSlider:SetScript("OnValueChanged", function(self, value)
        UnitFramesPlusDB["global"]["ptype"] = value;
        if value == 1 then
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG);
            UnitFramesPlus_OptionsFrame_GlobalPortrait3DBGText:SetTextColor(1, 1, 1);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo);
        elseif value == 2 then
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG);
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo);
            UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNoText:SetTextColor(1, 1, 1);
        end

        UnitFramesPlusDB["player"]["ptype"] = value;
        UnitFramesPlus_PlayerPortrait();
        if value == 1 then
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_PlayerPortrait3DBG);
            UnitFramesPlus_OptionsFrame_PlayerPortrait3DBGText:SetTextColor(1, 1, 1);
        else
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PlayerPortrait3DBG);
        end
        UnitFramesPlus_OptionsFrame_PlayerPortraitTypeSlider:SetValue(value);

        UnitFramesPlusDB["target"]["ptype"] = value;
        UnitFramesPlus_TargetPortrait();
        if value == 1 then
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_TargetPortrait3DBG);
            UnitFramesPlus_OptionsFrame_TargetPortrait3DBGText:SetTextColor(1, 1, 1);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetPortraitNPCNo);
        elseif value == 2 then
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetPortrait3DBG);
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_TargetPortraitNPCNo);
            UnitFramesPlus_OptionsFrame_TargetPortraitNPCNoText:SetTextColor(1, 1, 1);
        end
        UnitFramesPlus_OptionsFrame_TargetPortraitTypeSlider:SetValue(value);

        UnitFramesPlusDB["focus"]["ptype"] = value;
        UnitFramesPlus_FocusPortrait();
        if value == 1 then
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_FocusPortrait3DBG);
            UnitFramesPlus_OptionsFrame_FocusPortrait3DBGText:SetTextColor(1, 1, 1);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_FocusPortraitNPCNo);
        elseif value == 2 then
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_FocusPortrait3DBG);
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_FocusPortraitNPCNo);
            UnitFramesPlus_OptionsFrame_FocusPortraitNPCNoText:SetTextColor(1, 1, 1);
        end
        UnitFramesPlus_OptionsFrame_FocusPortraitTypeSlider:SetValue(value);
    end)

    --全局3D头像背景
    local UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG", UnitFramesPlus_Global_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_GlobalPortraitType, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_GlobalPortrait3DBGText:SetText(UFP_OP_Portrait_3DBG);
    UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG:SetScript("OnClick", function(self)
        UnitFramesPlusDB["global"]["p3dbg"] = 1 - UnitFramesPlusDB["global"]["p3dbg"];
        UnitFramesPlusDB["player"]["p3dbg"] = UnitFramesPlusDB["global"]["p3dbg"];
        UnitFramesPlus_PlayerPortrait3DBGDisplayUpdate();
        UnitFramesPlus_OptionsFrame_PlayerPortrait3DBG:SetChecked(UnitFramesPlusDB["global"]["p3dbg"]==1);
        UnitFramesPlusDB["target"]["p3dbg"] = UnitFramesPlusDB["global"]["p3dbg"];
        UnitFramesPlus_TargetPortrait3DBGDisplayUpdate();
        UnitFramesPlus_OptionsFrame_TargetPortrait3DBG:SetChecked(UnitFramesPlusDB["global"]["p3dbg"]==1);
        UnitFramesPlusDB["focus"]["p3dbg"] = UnitFramesPlusDB["global"]["p3dbg"];
        UnitFramesPlus_FocusPortrait3DBGDisplayUpdate();
        UnitFramesPlus_OptionsFrame_FocusPortrait3DBG:SetChecked(UnitFramesPlusDB["global"]["p3dbg"]==1);
        self:SetChecked(UnitFramesPlusDB["global"]["p3dbg"]==1);
    end)

    --目标为NPC时不显示职业头像
    local UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo", UnitFramesPlus_Global_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG, "TOPLEFT", 180, 0);
    UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNoText:SetText(UFP_OP_NPCNo);
    UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo:SetScript("OnClick", function(self)
        UnitFramesPlusDB["global"]["npcno"] = 1 - UnitFramesPlusDB["global"]["npcno"];
        UnitFramesPlusDB["target"]["npcno"] = UnitFramesPlusDB["global"]["npcno"];
        UnitFramesPlus_TargetPortraitDisplayUpdate();
        UnitFramesPlus_OptionsFrame_TargetPortraitNPCNo:SetChecked(UnitFramesPlusDB["global"]["npcno"]==1);
        UnitFramesPlusDB["focus"]["npcno"] = UnitFramesPlusDB["global"]["npcno"];
        UnitFramesPlus_FocusPortraitDisplayUpdate();
        UnitFramesPlus_OptionsFrame_FocusPortraitNPCNo:SetChecked(UnitFramesPlusDB["global"]["npcno"]==1);
        self:SetChecked(UnitFramesPlusDB["global"]["npcno"]==1);
    end)

    --全局Shift拖动头像
    local UnitFramesPlus_OptionsFrame_GlobalShiftDrag = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_GlobalShiftDrag", UnitFramesPlus_Global_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_GlobalShiftDrag:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_GlobalShiftDrag:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_GlobalShiftDragText:SetText(UFP_OP_Shift_Movable);
    UnitFramesPlus_OptionsFrame_GlobalShiftDrag:SetScript("OnClick", function(self)
        UnitFramesPlusDB["global"]["movable"] = 1 - UnitFramesPlusDB["global"]["movable"];
        UnitFramesPlusDB["player"]["movable"] = UnitFramesPlusDB["global"]["movable"];
        UnitFramesPlus_OptionsFrame_PlayerShiftDrag:SetChecked(UnitFramesPlusDB["global"]["movable"]==1);
        UnitFramesPlusDB["target"]["movable"] = UnitFramesPlusDB["global"]["movable"];
        UnitFramesPlus_OptionsFrame_TargetShiftDrag:SetChecked(UnitFramesPlusDB["global"]["movable"]==1);
        UnitFramesPlusDB["focus"]["movable"] = UnitFramesPlusDB["global"]["movable"];
        UnitFramesPlus_OptionsFrame_FocusShiftDrag:SetChecked(UnitFramesPlusDB["global"]["movable"]==1);
        UnitFramesPlusDB["party"]["movable"] = UnitFramesPlusDB["global"]["movable"];
        UnitFramesPlus_OptionsFrame_PartyShiftDrag:SetChecked(UnitFramesPlusDB["global"]["movable"]==1);
        self:SetChecked(UnitFramesPlusDB["player"]["movable"]==1);
    end)

    --全局头像内战斗信息
    local UnitFramesPlus_OptionsFrame_GlobalPortraitIndicator = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_GlobalPortraitIndicator", UnitFramesPlus_Global_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_GlobalPortraitIndicator:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_GlobalShiftDrag, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_GlobalPortraitIndicator:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_GlobalPortraitIndicatorText:SetText(UFP_OP_Portrait_Indicator);
    UnitFramesPlus_OptionsFrame_GlobalPortraitIndicator:SetScript("OnClick", function(self)
        UnitFramesPlusDB["global"]["indicator"] = 1 - UnitFramesPlusDB["global"]["indicator"];
        UnitFramesPlusDB["player"]["indicator"] = UnitFramesPlusDB["global"]["indicator"];
        UnitFramesPlus_PlayerPortraitIndicator();
        UnitFramesPlus_OptionsFrame_PlayerPortraitIndicator:SetChecked(UnitFramesPlusDB["global"]["indicator"]==1);
        UnitFramesPlusDB["pet"]["indicator"] = UnitFramesPlusDB["global"]["indicator"];
        UnitFramesPlus_PetPortraitIndicator();
        UnitFramesPlus_OptionsFrame_PetPortraitIndicator:SetChecked(UnitFramesPlusDB["global"]["indicator"]==1);
        UnitFramesPlusDB["target"]["indicator"] = UnitFramesPlusDB["global"]["indicator"];
        UnitFramesPlus_TargetPortraitIndicator();
        UnitFramesPlus_OptionsFrame_TargetPortraitIndicator:SetChecked(UnitFramesPlusDB["global"]["indicator"]==1);
        UnitFramesPlusDB["focus"]["indicator"] = UnitFramesPlusDB["global"]["indicator"];
        UnitFramesPlus_FocusPortraitIndicator();
        UnitFramesPlus_OptionsFrame_FocusPortraitIndicator:SetChecked(UnitFramesPlusDB["global"]["indicator"]==1);
        UnitFramesPlusDB["party"]["indicator"] = UnitFramesPlusDB["global"]["indicator"];
        UnitFramesPlus_PartyPortraitIndicator();
        UnitFramesPlus_OptionsFrame_PartyPortraitIndicator:SetChecked(UnitFramesPlusDB["global"]["indicator"]==1);
        self:SetChecked(UnitFramesPlusDB["global"]["indicator"]==1);
    end)

    --全局生命条染色
    local UnitFramesPlus_OptionsFrame_GlobalColorHP = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_GlobalColorHP", UnitFramesPlus_Global_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_GlobalColorHP:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_GlobalPortraitIndicator, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_GlobalColorHP:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_GlobalColorHPText:SetText(UFP_OP_ColorHP_Text);
    UnitFramesPlus_OptionsFrame_GlobalColorHP:SetScript("OnClick", function(self)
        UnitFramesPlusDB["global"]["colorhp"] = 1 - UnitFramesPlusDB["global"]["colorhp"];
        UnitFramesPlusDB["player"]["colorhp"] = UnitFramesPlusDB["global"]["colorhp"];
        BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_PlayerColorHPSlider);
        UnitFramesPlus_PlayerColorHPBar();
        UnitFramesPlus_PlayerColorHPBarDisplayUpdate();
        UnitFramesPlus_OptionsFrame_PlayerColorHP:SetChecked(UnitFramesPlusDB["global"]["colorhp"]==1);
        UnitFramesPlusDB["target"]["colorhp"] = UnitFramesPlusDB["global"]["colorhp"];
        UnitFramesPlus_TargetColorHPBar();
        UnitFramesPlus_TargetColorHPBarDisplayUpdate();
        UnitFramesPlus_OptionsFrame_TargetColorHP:SetChecked(UnitFramesPlusDB["global"]["colorhp"]==1);
        UnitFramesPlusDB["focus"]["colorhp"] = UnitFramesPlusDB["global"]["colorhp"];
        UnitFramesPlus_FocusColorHPBar();
        UnitFramesPlus_FocusColorHPBarDisplayUpdate();
        UnitFramesPlus_OptionsFrame_FocusColorHP:SetChecked(UnitFramesPlusDB["global"]["colorhp"]==1);
        UnitFramesPlusDB["party"]["colorhp"] = UnitFramesPlusDB["global"]["colorhp"];
        UnitFramesPlus_PartyColorHPBar();
        for id = 1, 4, 1 do
            UnitFramesPlus_PartyColorHPBarDisplayUpdate(id);
        end
        UnitFramesPlus_OptionsFrame_PartyColorHP:SetChecked(UnitFramesPlusDB["global"]["colorhp"]==1);
        if UnitFramesPlusDB["global"]["colorhp"] == 1 then
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_GlobalColorHPSlider);
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_PlayerColorHPSlider);
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_TargetColorHPSlider);
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_FocusColorHPSlider);
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_PartyColorHPSlider);
        else
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_GlobalColorHPSlider);
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_PlayerColorHPSlider);
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_TargetColorHPSlider);
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_FocusColorHPSlider);
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_PartyColorHPSlider);
        end
        self:SetChecked(UnitFramesPlusDB["global"]["colorhp"]==1);
    end)

    --全局生命条染色类型
    local UnitFramesPlus_OptionsFrame_GlobalColorHPSlider = CreateFrame("Slider", "UnitFramesPlus_OptionsFrame_GlobalColorHPSlider", UnitFramesPlus_Global_Options, "OptionsSliderTemplate");
    UnitFramesPlus_OptionsFrame_GlobalColorHPSlider:SetWidth(95);
    UnitFramesPlus_OptionsFrame_GlobalColorHPSlider:SetHeight(16);
    UnitFramesPlus_OptionsFrame_GlobalColorHPSlider:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_GlobalColorHP, "TOPLEFT", 183, 0);
    UnitFramesPlus_OptionsFrame_GlobalColorHPSliderLow:SetText(UFP_OP_ColorHP_Class);
    UnitFramesPlus_OptionsFrame_GlobalColorHPSliderHigh:SetText(UFP_OP_ColorHP_HPPct);
    UnitFramesPlus_OptionsFrame_GlobalColorHPSlider:SetMinMaxValues(1,2);
    UnitFramesPlus_OptionsFrame_GlobalColorHPSlider:SetValueStep(1);
    UnitFramesPlus_OptionsFrame_GlobalColorHPSlider:SetObeyStepOnDrag(true);
    UnitFramesPlus_OptionsFrame_GlobalColorHPSlider:SetScript("OnValueChanged", function(self, value)
        UnitFramesPlusDB["global"]["colortype"] = value;
        UnitFramesPlusDB["player"]["colortype"] = value;
        UnitFramesPlus_PlayerColorHPBar();
        UnitFramesPlus_PlayerColorHPBarDisplayUpdate();
        UnitFramesPlus_OptionsFrame_PlayerColorHPSlider:SetValue(value);
        UnitFramesPlusDB["target"]["colortype"] = value;
        UnitFramesPlus_TargetColorHPBar();
        UnitFramesPlus_TargetColorHPBarDisplayUpdate();
        UnitFramesPlus_OptionsFrame_TargetColorHPSlider:SetValue(value);
        UnitFramesPlusDB["focus"]["colortype"] = value;
        UnitFramesPlus_FocusColorHPBar();
        UnitFramesPlus_FocusColorHPBarDisplayUpdate();
        UnitFramesPlus_OptionsFrame_FocusColorHPSlider:SetValue(value);
        UnitFramesPlusDB["party"]["colortype"] = value;
        UnitFramesPlus_PartyColorHPBar();
        for id = 1, 4, 1 do
            UnitFramesPlus_PartyColorHPBarDisplayUpdate(id);
        end
        UnitFramesPlus_OptionsFrame_PartyColorHPSlider:SetValue(value);
    end)

    --玩家设定
    local playerconfig = UnitFramesPlus_Player_Options:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge");
    playerconfig:SetPoint("TOPLEFT", 16, -16);
    playerconfig:SetText(UFP_OP_Player_Options);

    --精英头像
    local UnitFramesPlus_OptionsFrame_PlayerDragonBorder = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PlayerDragonBorder", UnitFramesPlus_Player_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PlayerDragonBorder:SetPoint("TOPLEFT", playerconfig, "TOPLEFT", 0, -40);
    UnitFramesPlus_OptionsFrame_PlayerDragonBorder:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PlayerDragonBorderText:SetText(UFP_OP_Player_Dragon);
    UnitFramesPlus_OptionsFrame_PlayerDragonBorder:SetScript("OnClick", function(self)
        UnitFramesPlusDB["player"]["dragon"] = 1 - UnitFramesPlusDB["player"]["dragon"];
        if UnitFramesPlusDB["player"]["dragon"] == 1 then
            UIDropDownMenu_EnableDropDown(UnitFramesPlus_OptionsFrame_PlayerExtBorderType);
        else
            UIDropDownMenu_DisableDropDown(UnitFramesPlus_OptionsFrame_PlayerExtBorderType);
        end
        UnitFramesPlus_PlayerDragon();
        self:SetChecked(UnitFramesPlusDB["player"]["dragon"]==1);
    end)

    local UnitFramesPlus_OptionsFrame_PlayerExtBorderType = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PlayerExtBorderType", UnitFramesPlus_Player_Options, "UIDropDownMenuTemplate");
    UnitFramesPlus_OptionsFrame_PlayerExtBorderType:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PlayerDragonBorder, "TOPLEFT", 165, 0);
    UnitFramesPlus_OptionsFrame_PlayerExtBorderType:SetHitRectInsets(0, -100, 0, 0);
    UIDropDownMenu_SetWidth(UnitFramesPlus_OptionsFrame_PlayerExtBorderType, 95);
    UIDropDownMenu_Initialize(UnitFramesPlus_OptionsFrame_PlayerExtBorderType, PlayerExtBorderType_Init);
    UIDropDownMenu_SetSelectedID(UnitFramesPlus_OptionsFrame_PlayerExtBorderType, UnitFramesPlusDB["player"]["raretype"]);

    --扩展框
    local UnitFramesPlus_OptionsFrame_PlayerExtbar = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PlayerExtbar", UnitFramesPlus_Player_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PlayerExtbar:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PlayerDragonBorder, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PlayerExtbar:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PlayerExtbarText:SetText(UFP_OP_Player_Extbar);
    UnitFramesPlus_OptionsFrame_PlayerExtbar:SetScript("OnClick", function(self)
        UnitFramesPlusDB["player"]["extbar"] = 1 - UnitFramesPlusDB["player"]["extbar"];
        if UnitFramesPlusDB["player"]["extbar"] == 1 then
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PlayerHPMPPct);
            UnitFramesPlusDB["player"]["hpmp"] = 1;
            UnitFramesPlus_OptionsFrame_PlayerHPMPPct:SetChecked(UnitFramesPlusDB["player"]["hpmp"]==1);
            UIDropDownMenu_EnableDropDown(UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartOne);
            UIDropDownMenu_EnableDropDown(UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartTwo);
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_PlayerHPMPUnit);
            UnitFramesPlus_OptionsFrame_PlayerHPMPUnitText:SetTextColor(1, 1, 1);
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_PlayerCoordinate);
            UnitFramesPlus_OptionsFrame_PlayerCoordinateText:SetTextColor(1, 1, 1);
        else
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_PlayerHPMPPct);
            UnitFramesPlus_OptionsFrame_PlayerHPMPPctText:SetTextColor(1, 1, 1);
        end
        UnitFramesPlus_PlayerExtbar();
        self:SetChecked(UnitFramesPlusDB["player"]["extbar"]==1);
    end)

    --玩家坐标
    local UnitFramesPlus_OptionsFrame_PlayerCoordinate = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PlayerCoordinate", UnitFramesPlus_Player_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PlayerCoordinate:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PlayerExtbar, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PlayerCoordinate:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PlayerCoordinateText:SetText(UFP_OP_Player_Coordinate);
    UnitFramesPlus_OptionsFrame_PlayerCoordinate:SetScript("OnClick", function(self)
        UnitFramesPlusDB["player"]["coord"] = 1 - UnitFramesPlusDB["player"]["coord"];
        UnitFramesPlus_PlayerCoordinate();
        UnitFramesPlus_PlayerCoordinateDisplayUpdate();
        UnitFramesPlus_PlayerHPValueDisplayUpdate();
        if UnitFramesPlusDB["player"]["coord"] == 1 then
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_PlayerCoordinateInInstance);
            UnitFramesPlus_OptionsFrame_PlayerCoordinateInInstanceText:SetTextColor(1, 1, 1);
        else
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PlayerCoordinateInInstance);
        end
        self:SetChecked(UnitFramesPlusDB["player"]["coord"]==1);
    end)

    --副本战场内显示百分比
    local UnitFramesPlus_OptionsFrame_PlayerCoordinateInInstance = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PlayerCoordinateInInstance", UnitFramesPlus_Player_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PlayerCoordinateInInstance:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PlayerCoordinate, "TOPLEFT", 180, 0);
    UnitFramesPlus_OptionsFrame_PlayerCoordinateInInstance:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PlayerCoordinateInInstanceText:SetText(UFP_OP_Player_Coordinate_InInstance);
    UnitFramesPlus_OptionsFrame_PlayerCoordinateInInstance:SetScript("OnClick", function(self)
        UnitFramesPlusDB["player"]["coordpct"] = 1 - UnitFramesPlusDB["player"]["coordpct"];
        UnitFramesPlus_PlayerCoordinateDisplayUpdate();
        UnitFramesPlus_PlayerHPValueDisplayUpdate();
        self:SetChecked(UnitFramesPlusDB["player"]["coordpct"]==1);
    end)

    --不显示扩展框时的生命值和法力值(百分比)
    local UnitFramesPlus_OptionsFrame_PlayerHPMPPct = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PlayerHPMPPct", UnitFramesPlus_Player_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PlayerHPMPPct:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PlayerCoordinate, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PlayerHPMPPct:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PlayerHPMPPctText:SetText(UFP_OP_Player_HPMP);
    UnitFramesPlus_OptionsFrame_PlayerHPMPPct:SetScript("OnClick", function(self)
        UnitFramesPlusDB["player"]["hpmp"] = 1 - UnitFramesPlusDB["player"]["hpmp"];
        if UnitFramesPlusDB["player"]["hpmp"] == 1 then
            UIDropDownMenu_EnableDropDown(UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartOne);
            UIDropDownMenu_EnableDropDown(UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartTwo);
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_PlayerHPMPUnit);
            UnitFramesPlus_OptionsFrame_PlayerHPMPUnitText:SetTextColor(1, 1, 1);
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_PlayerCoordinate);
            UnitFramesPlus_OptionsFrame_PlayerCoordinateText:SetTextColor(1, 1, 1);
        else
            UIDropDownMenu_DisableDropDown(UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartOne);
            UIDropDownMenu_DisableDropDown(UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartTwo);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PlayerHPMPUnit);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PlayerCoordinate);
        end
        UnitFramesPlus_PlayerHPMPPct();
        self:SetChecked(UnitFramesPlusDB["player"]["hpmp"]==1);
    end)

    --生命值/法力值/百分比第一部分
    local UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartOne = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartOne", UnitFramesPlus_Player_Options, "UIDropDownMenuTemplate");
    UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartOne:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PlayerHPMPPct, "TOPLEFT", 165, 0);
    UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartOne:SetHitRectInsets(0, -100, 0, 0);
    UIDropDownMenu_SetWidth(UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartOne, 95);
    UIDropDownMenu_Initialize(UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartOne, PlayerHPMPPctPartOne_Init);
    UIDropDownMenu_SetSelectedID(UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartOne, UnitFramesPlusDB["player"]["hpmppartone"]);

    --斜线
    local splitline = UnitFramesPlus_Player_Options:CreateFontString(nil, "ARTWORK", "TextStatusBarText");
    splitline:SetPoint("LEFT", UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartOne, "RIGHT", -5, 0);
    splitline:SetText("/");

    --生命值/法力值/百分比第二部分
    local UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartTwo = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartTwo", UnitFramesPlus_Player_Options, "UIDropDownMenuTemplate");
    UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartTwo:SetPoint("LEFT", splitline, "RIGHT", -11, 0);
    UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartTwo:SetHitRectInsets(0, -100, 0, 0);
    UIDropDownMenu_SetWidth(UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartTwo, 95);
    UIDropDownMenu_Initialize(UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartTwo, PlayerHPMPPctPartTwo_Init);
    UIDropDownMenu_SetSelectedID(UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartTwo, UnitFramesPlusDB["player"]["hpmpparttwo"]);

    --生命值、法力值单位
    local UnitFramesPlus_OptionsFrame_PlayerHPMPUnit = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PlayerHPMPUnit", UnitFramesPlus_Player_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PlayerHPMPUnit:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PlayerHPMPPct, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PlayerHPMPUnit:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PlayerHPMPUnitText:SetText(UFP_OP_Player_Unit);
    UnitFramesPlus_OptionsFrame_PlayerHPMPUnit:SetScript("OnClick", function(self)
        UnitFramesPlusDB["player"]["unit"] = 1 - UnitFramesPlusDB["player"]["unit"];
        if GetLocale() == "zhCN" or GetLocale() == "zhTW" then
            if UnitFramesPlusDB["player"]["unit"] == 1 then
                BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_PlayerUnitTypeSlider);
            else
                BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_PlayerUnitTypeSlider);
            end
        end
        UnitFramesPlus_PlayerHPValueDisplayUpdate();
        UnitFramesPlus_PlayerMPValueDisplayUpdate();
        self:SetChecked(UnitFramesPlusDB["player"]["unit"]==1);
    end)

    --生命值、法力值单位
    if GetLocale() == "zhCN" or GetLocale() == "zhTW" then
        local UnitFramesPlus_OptionsFrame_PlayerUnitTypeSlider = CreateFrame("Slider", "UnitFramesPlus_OptionsFrame_PlayerUnitTypeSlider", UnitFramesPlus_Player_Options, "OptionsSliderTemplate");
        UnitFramesPlus_OptionsFrame_PlayerUnitTypeSlider:SetWidth(95);
        UnitFramesPlus_OptionsFrame_PlayerUnitTypeSlider:SetHeight(16);
        UnitFramesPlus_OptionsFrame_PlayerUnitTypeSlider:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PlayerHPMPUnit, "TOPLEFT", 183, 0);
        UnitFramesPlus_OptionsFrame_PlayerUnitTypeSliderLow:SetText(UFP_OP_Player_UnitK);
        UnitFramesPlus_OptionsFrame_PlayerUnitTypeSliderHigh:SetText(UFP_OP_Player_UnitW);
        UnitFramesPlus_OptionsFrame_PlayerUnitTypeSlider:SetMinMaxValues(1,2);
        UnitFramesPlus_OptionsFrame_PlayerUnitTypeSlider:SetValueStep(1);
        UnitFramesPlus_OptionsFrame_PlayerUnitTypeSlider:SetObeyStepOnDrag(true);
        UnitFramesPlus_OptionsFrame_PlayerUnitTypeSlider:SetScript("OnValueChanged", function(self, value)
            UnitFramesPlusDB["player"]["unittype"] = value;
            UnitFramesPlus_PlayerHPValueDisplayUpdate();
            UnitFramesPlus_PlayerMPValueDisplayUpdate();
        end)
    end

    --玩家头像自动隐藏
    local UnitFramesPlus_OptionsFrame_PlayerFrameAutohide = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PlayerFrameAutohide", UnitFramesPlus_Player_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PlayerFrameAutohide:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PlayerHPMPUnit, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PlayerFrameAutohide:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PlayerFrameAutohideText:SetText(UFP_OP_Player_Autohide);
    UnitFramesPlus_OptionsFrame_PlayerFrameAutohide:SetScript("OnClick", function(self)
        UnitFramesPlusDB["player"]["autohide"] = 1 - UnitFramesPlusDB["player"]["autohide"];
        UnitFramesPlus_PlayerFrameAutohide();
        UnitFramesPlus_PlayerFrameAutohideDisplayUpdate();
        self:SetChecked(UnitFramesPlusDB["player"]["autohide"]==1);
    end)

    --头像缩放
    local UnitFramesPlus_OptionsFrame_PlayerFrameScaleSlider = CreateFrame("Slider", "UnitFramesPlus_OptionsFrame_PlayerFrameScaleSlider", UnitFramesPlus_Player_Options, "OptionsSliderTemplate");
    UnitFramesPlus_OptionsFrame_PlayerFrameScaleSlider:SetWidth(154);
    UnitFramesPlus_OptionsFrame_PlayerFrameScaleSlider:SetHeight(16);
    UnitFramesPlus_OptionsFrame_PlayerFrameScaleSlider:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PlayerFrameAutohide, "TOPLEFT", 30, -45);
    UnitFramesPlus_OptionsFrame_PlayerFrameScaleSliderText:SetText(UFP_OP_Player_Scale..(UnitFramesPlusDB["player"]["scale"]*100).."%");
    UnitFramesPlus_OptionsFrame_PlayerFrameScaleSliderLow:SetText("50%");
    UnitFramesPlus_OptionsFrame_PlayerFrameScaleSliderHigh:SetText("150%");
    UnitFramesPlus_OptionsFrame_PlayerFrameScaleSlider:SetMinMaxValues(50,150);
    UnitFramesPlus_OptionsFrame_PlayerFrameScaleSlider:SetValueStep(1);
    UnitFramesPlus_OptionsFrame_PlayerFrameScaleSlider:SetObeyStepOnDrag(true);
    UnitFramesPlus_OptionsFrame_PlayerFrameScaleSlider:SetScript("OnValueChanged", function(self, value)
        UnitFramesPlus_PlayerFrameScale(UnitFramesPlusDB["player"]["scale"], value/100);
        UnitFramesPlusDB["player"]["scale"] = value/100;
        UnitFramesPlus_OptionsFrame_PlayerFrameScaleSliderText:SetText(UFP_OP_Player_Scale..(UnitFramesPlusDB["player"]["scale"]*100).."%");
    end)

    --鼠标移过时才显示数值
    local UnitFramesPlus_OptionsFrame_PlayerMouseShow = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PlayerMouseShow", UnitFramesPlus_Player_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PlayerMouseShow:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PlayerFrameScaleSlider, "TOPLEFT", -30, -35);
    UnitFramesPlus_OptionsFrame_PlayerMouseShow:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PlayerMouseShowText:SetText(UFP_OP_Mouse_Show);
    UnitFramesPlus_OptionsFrame_PlayerMouseShow:SetScript("OnClick", function(self)
        if tonumber(GetCVar("statusText")) ~= 1 then
            StaticPopup_Show("UFP_MOUSESHOW");
            self:SetChecked(UnitFramesPlusDB["player"]["mouseshow"]==1);
            return;
        end
        UnitFramesPlusDB["player"]["mouseshow"] = 1 - UnitFramesPlusDB["player"]["mouseshow"];
        if UnitFramesPlusDB["player"]["mouseshow"] == 1 then
            if UnitFramesPlusDB["pet"]["mouseshow"] == 1 
            and UnitFramesPlusDB["target"]["mouseshow"] == 1 
            and UnitFramesPlusDB["focus"]["mouseshow"] == 1 
            and UnitFramesPlusDB["party"]["mouseshow"] == 1 then
                UnitFramesPlusDB["global"]["mouseshow"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalMouseShow:SetChecked(true);
            end
        else
            UnitFramesPlusDB["global"]["mouseshow"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalMouseShow:SetChecked(false);
        end
        UnitFramesPlus_PlayerBarTextMouseShow();
        self:SetChecked(UnitFramesPlusDB["player"]["mouseshow"]==1);
    end)

    --玩家头像类型开关
    local UnitFramesPlus_OptionsFrame_PlayerPortraitType = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PlayerPortraitType", UnitFramesPlus_Player_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PlayerPortraitType:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PlayerMouseShow, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PlayerPortraitType:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PlayerPortraitTypeText:SetText(UFP_OP_Portrait);
    UnitFramesPlus_OptionsFrame_PlayerPortraitType:SetScript("OnClick", function(self)
        UnitFramesPlusDB["player"]["portrait"] = 1 - UnitFramesPlusDB["player"]["portrait"];
        UnitFramesPlus_PlayerPortrait();
        if UnitFramesPlusDB["player"]["portrait"] == 1 then
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_PlayerPortraitTypeSlider);
            if UnitFramesPlusDB["player"]["ptype"] == 1 then
                BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_PlayerPortrait3DBG);
                UnitFramesPlus_OptionsFrame_PlayerPortrait3DBGText:SetTextColor(1, 1, 1);
            end
            if UnitFramesPlusDB["target"]["portrait"] == 1 
            and UnitFramesPlusDB["focus"]["portrait"] == 1 then
                UnitFramesPlusDB["global"]["portrait"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalPortraitType:SetChecked(true);
                BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSlider);
                if UnitFramesPlusDB["global"]["ptype"] == 1 then
                    BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG);
                    UnitFramesPlus_OptionsFrame_GlobalPortrait3DBGText:SetTextColor(1, 1, 1);
                elseif UnitFramesPlusDB["global"]["ptype"] == 2 then
                    BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo);
                end
            end
        else
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_PlayerPortraitTypeSlider);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PlayerPortrait3DBG);
            UnitFramesPlusDB["global"]["portrait"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalPortraitType:SetChecked(false);
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSlider);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo);
        end
        self:SetChecked(UnitFramesPlusDB["player"]["portrait"]==1);
    end)

    --玩家头像类型
    local UnitFramesPlus_OptionsFrame_PlayerPortraitTypeSlider = CreateFrame("Slider", "UnitFramesPlus_OptionsFrame_PlayerPortraitTypeSlider", UnitFramesPlus_Player_Options, "OptionsSliderTemplate");
    UnitFramesPlus_OptionsFrame_PlayerPortraitTypeSlider:SetWidth(95);
    UnitFramesPlus_OptionsFrame_PlayerPortraitTypeSlider:SetHeight(16);
    UnitFramesPlus_OptionsFrame_PlayerPortraitTypeSlider:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PlayerPortraitType, "TOPLEFT", 183, 0);
    UnitFramesPlus_OptionsFrame_PlayerPortraitTypeSliderLow:SetText(UFP_OP_3D);
    UnitFramesPlus_OptionsFrame_PlayerPortraitTypeSliderHigh:SetText(UFP_OP_CLASS);
    UnitFramesPlus_OptionsFrame_PlayerPortraitTypeSlider:SetMinMaxValues(1,2);
    UnitFramesPlus_OptionsFrame_PlayerPortraitTypeSlider:SetValueStep(1);
    UnitFramesPlus_OptionsFrame_PlayerPortraitTypeSlider:SetObeyStepOnDrag(true);
    UnitFramesPlus_OptionsFrame_PlayerPortraitTypeSlider:SetScript("OnValueChanged", function(self, value)
        UnitFramesPlusDB["player"]["ptype"] = value;
        UnitFramesPlus_PlayerPortrait();
        if value == 1 then
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_PlayerPortrait3DBG);
            UnitFramesPlus_OptionsFrame_PlayerPortrait3DBGText:SetTextColor(1, 1, 1);
        else
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PlayerPortrait3DBG);
        end
    end)

    --玩家3D头像背景
    local UnitFramesPlus_OptionsFrame_PlayerPortrait3DBG = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PlayerPortrait3DBG", UnitFramesPlus_Player_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PlayerPortrait3DBG:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PlayerPortraitType, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PlayerPortrait3DBG:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PlayerPortrait3DBGText:SetText(UFP_OP_Portrait_3DBG);
    UnitFramesPlus_OptionsFrame_PlayerPortrait3DBG:SetScript("OnClick", function(self)
        UnitFramesPlusDB["player"]["p3dbg"] = 1 - UnitFramesPlusDB["player"]["p3dbg"];
        UnitFramesPlus_PlayerPortrait3DBGDisplayUpdate();
        if UnitFramesPlusDB["player"]["p3dbg"] == 1 then
            if UnitFramesPlusDB["target"]["p3dbg"] == 1 
            and UnitFramesPlusDB["focus"]["p3dbg"] == 1 then
                if UnitFramesPlusDB["global"]["portrait"] == 1 
                and UnitFramesPlusDB["global"]["ptype"] == 1 then
                    UnitFramesPlusDB["global"]["p3dbg"] = 1;
                    UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG:SetChecked(true);
                end
            end
        else
            UnitFramesPlusDB["global"]["p3dbg"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG:SetChecked(false);
        end
        self:SetChecked(UnitFramesPlusDB["player"]["p3dbg"]==1);
    end)

    --Shift拖动头像
    local UnitFramesPlus_OptionsFrame_PlayerShiftDrag = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PlayerShiftDrag", UnitFramesPlus_Player_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PlayerShiftDrag:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PlayerPortrait3DBG, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PlayerShiftDrag:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PlayerShiftDragText:SetText(UFP_OP_Shift_Movable);
    UnitFramesPlus_OptionsFrame_PlayerShiftDrag:SetScript("OnClick", function(self)
        UnitFramesPlusDB["player"]["movable"] = 1 - UnitFramesPlusDB["player"]["movable"];
        if UnitFramesPlusDB["player"]["movable"] == 1 then
            if UnitFramesPlusDB["target"]["movable"] == 1 
            and UnitFramesPlusDB["focus"]["movable"] == 1 
            and UnitFramesPlusDB["party"]["movable"] == 1 then
                UnitFramesPlusDB["global"]["movable"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalShiftDrag:SetChecked(true);
            end
        else
            UnitFramesPlusDB["global"]["movable"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalShiftDrag:SetChecked(false);
        end
        self:SetChecked(UnitFramesPlusDB["player"]["movable"]==1);
    end)

    --玩家头像内战斗信息
    local UnitFramesPlus_OptionsFrame_PlayerPortraitIndicator = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PlayerPortraitIndicator", UnitFramesPlus_Player_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PlayerPortraitIndicator:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PlayerShiftDrag, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PlayerPortraitIndicator:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PlayerPortraitIndicatorText:SetText(UFP_OP_Portrait_Indicator);
    UnitFramesPlus_OptionsFrame_PlayerPortraitIndicator:SetScript("OnClick", function(self)
        UnitFramesPlusDB["player"]["indicator"] = 1 - UnitFramesPlusDB["player"]["indicator"];
        UnitFramesPlus_PlayerPortraitIndicator();
        if UnitFramesPlusDB["player"]["indicator"] == 1 then
            if UnitFramesPlusDB["pet"]["indicator"] == 1 
            and UnitFramesPlusDB["target"]["indicator"] == 1
            and UnitFramesPlusDB["focus"]["indicator"] == 1 
            and UnitFramesPlusDB["party"]["indicator"] == 1 then
                UnitFramesPlusDB["global"]["indicator"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalPortraitIndicator:SetChecked(true);
            end
        else
            UnitFramesPlusDB["global"]["indicator"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalPortraitIndicator:SetChecked(false);
        end
        self:SetChecked(UnitFramesPlusDB["player"]["indicator"]==1);
    end)

    --生命条染色
    local UnitFramesPlus_OptionsFrame_PlayerColorHP = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PlayerColorHP", UnitFramesPlus_Player_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PlayerColorHP:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PlayerPortraitIndicator, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PlayerColorHP:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PlayerColorHPText:SetText(UFP_OP_ColorHP_Text);
    UnitFramesPlus_OptionsFrame_PlayerColorHP:SetScript("OnClick", function(self)
        UnitFramesPlusDB["player"]["colorhp"] = 1 - UnitFramesPlusDB["player"]["colorhp"];
        if UnitFramesPlusDB["player"]["colorhp"] == 1 then
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_PlayerColorHPSlider);
        else
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_PlayerColorHPSlider);
        end
        UnitFramesPlus_PlayerColorHPBar();
        UnitFramesPlus_PlayerColorHPBarDisplayUpdate();
        if UnitFramesPlusDB["player"]["colorhp"] == 1 then
            if UnitFramesPlusDB["target"]["colorhp"] == 1 
            and UnitFramesPlusDB["focus"]["colorhp"] == 1 
            and UnitFramesPlusDB["party"]["colorhp"] == 1 then
                UnitFramesPlusDB["global"]["colorhp"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalColorHP:SetChecked(true);
                BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_GlobalColorHPSlider);
            end
        else
            UnitFramesPlusDB["global"]["colorhp"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalColorHP:SetChecked(false);
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_GlobalColorHPSlider);
        end
        self:SetChecked(UnitFramesPlusDB["player"]["colorhp"]==1);
    end)

    --生命条染色类型
    local UnitFramesPlus_OptionsFrame_PlayerColorHPSlider = CreateFrame("Slider", "UnitFramesPlus_OptionsFrame_PlayerColorHPSlider", UnitFramesPlus_Player_Options, "OptionsSliderTemplate");
    UnitFramesPlus_OptionsFrame_PlayerColorHPSlider:SetWidth(95);
    UnitFramesPlus_OptionsFrame_PlayerColorHPSlider:SetHeight(16);
    UnitFramesPlus_OptionsFrame_PlayerColorHPSlider:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PlayerColorHP, "TOPLEFT", 183, 0);
    UnitFramesPlus_OptionsFrame_PlayerColorHPSliderLow:SetText(UFP_OP_ColorHP_Class);
    UnitFramesPlus_OptionsFrame_PlayerColorHPSliderHigh:SetText(UFP_OP_ColorHP_HPPct);
    UnitFramesPlus_OptionsFrame_PlayerColorHPSlider:SetMinMaxValues(1,2);
    UnitFramesPlus_OptionsFrame_PlayerColorHPSlider:SetValueStep(1);
    UnitFramesPlus_OptionsFrame_PlayerColorHPSlider:SetObeyStepOnDrag(true);
    UnitFramesPlus_OptionsFrame_PlayerColorHPSlider:SetScript("OnValueChanged", function(self, value)
        UnitFramesPlusDB["player"]["colortype"] = value;
        UnitFramesPlus_PlayerColorHPBar();
        UnitFramesPlus_PlayerColorHPBarDisplayUpdate();
    end)

    --宠物设定
    local petconfig = UnitFramesPlus_Pet_Options:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge");
    petconfig:SetPoint("TOPLEFT", 16, -16);
    petconfig:SetText(UFP_OP_Pet_Options);

    --宠物目标
    local UnitFramesPlus_OptionsFrame_PetTarget = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PetTarget", UnitFramesPlus_Pet_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PetTarget:SetPoint("TOPLEFT", petconfig, "TOPLEFT", 0, -40);
    UnitFramesPlus_OptionsFrame_PetTarget:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PetTargetText:SetText(UFP_OP_Pet_Target);
    UnitFramesPlus_OptionsFrame_PetTarget:SetScript("OnClick", function(self)
        UnitFramesPlusDB["pet"]["target"] = 1 - UnitFramesPlusDB["pet"]["target"];    
        if UnitFramesPlusDB["pet"]["target"] == 1 then
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_PetTargetHPPct);
            UnitFramesPlus_OptionsFrame_PetTargetHPPctText:SetTextColor(1, 1, 1);
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_PetTargetScaleSlider);
            UnitFramesPlus_OptionsFrame_PetTargetScaleSliderText:SetTextColor(1, 1, 1);
        else
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PetTargetHPPct);
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_PetTargetScaleSlider);
        end
        UnitFramesPlus_PetTarget();
        self:SetChecked(UnitFramesPlusDB["pet"]["target"]==1);
    end)

    --宠物目标生命值百分比
    local UnitFramesPlus_OptionsFrame_PetTargetHPPct = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PetTargetHPPct", UnitFramesPlus_Pet_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PetTargetHPPct:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PetTarget, "TOPLEFT", 180, 0);
    UnitFramesPlus_OptionsFrame_PetTargetHPPct:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PetTargetHPPctText:SetText(UFP_OP_Pet_HPPct);
    UnitFramesPlus_OptionsFrame_PetTargetHPPct:SetScript("OnClick", function(self)
        UnitFramesPlusDB["pet"]["hppct"] = 1 - UnitFramesPlusDB["pet"]["hppct"];
        self:SetChecked(UnitFramesPlusDB["pet"]["hppct"]==1);
    end)

    --宠物目标缩放
    local UnitFramesPlus_OptionsFrame_PetTargetScaleSlider = CreateFrame("Slider", "UnitFramesPlus_OptionsFrame_PetTargetScaleSlider", UnitFramesPlus_Pet_Options, "OptionsSliderTemplate");
    UnitFramesPlus_OptionsFrame_PetTargetScaleSlider:SetWidth(154);
    UnitFramesPlus_OptionsFrame_PetTargetScaleSlider:SetHeight(16);
    UnitFramesPlus_OptionsFrame_PetTargetScaleSlider:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PetTarget, "TOPLEFT", 30, -45);
    UnitFramesPlus_OptionsFrame_PetTargetScaleSliderText:SetText(UFP_OP_Pet_Scale..(UnitFramesPlusDB["pet"]["scale"]*100).."%");
    UnitFramesPlus_OptionsFrame_PetTargetScaleSliderLow:SetText("50%");
    UnitFramesPlus_OptionsFrame_PetTargetScaleSliderHigh:SetText("150%");
    UnitFramesPlus_OptionsFrame_PetTargetScaleSlider:SetMinMaxValues(50,150);
    UnitFramesPlus_OptionsFrame_PetTargetScaleSlider:SetValueStep(1);
    UnitFramesPlus_OptionsFrame_PetTargetScaleSlider:SetObeyStepOnDrag(true);
    UnitFramesPlus_OptionsFrame_PetTargetScaleSlider:SetScript("OnValueChanged", function(self, value)
        UnitFramesPlus_PetTargetScale(UnitFramesPlusDB["pet"]["scale"], value/100);
        UnitFramesPlusDB["pet"]["scale"] = value/100;
        UnitFramesPlus_OptionsFrame_PetTargetScaleSliderText:SetText(UFP_OP_Pet_Scale..(UnitFramesPlusDB["pet"]["scale"]*100).."%");
    end)

    --鼠标移过时才显示数值
    local UnitFramesPlus_OptionsFrame_PetMouseShow = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PetMouseShow", UnitFramesPlus_Pet_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PetMouseShow:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PetTargetScaleSlider, "TOPLEFT", -30, -35);
    UnitFramesPlus_OptionsFrame_PetMouseShow:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PetMouseShowText:SetText(UFP_OP_Mouse_Show);
    UnitFramesPlus_OptionsFrame_PetMouseShow:SetScript("OnClick", function(self)
        if tonumber(GetCVar("statusText")) ~= 1 then
            StaticPopup_Show("UFP_MOUSESHOW");
            self:SetChecked(UnitFramesPlusDB["pet"]["mouseshow"]==1);
            return;
        end
        UnitFramesPlusDB["pet"]["mouseshow"] = 1 - UnitFramesPlusDB["pet"]["mouseshow"];
        if UnitFramesPlusDB["pet"]["mouseshow"] == 1 then
            if UnitFramesPlusDB["target"]["mouseshow"] == 1 
            and UnitFramesPlusDB["focus"]["mouseshow"] == 1 
            and UnitFramesPlusDB["party"]["mouseshow"] == 1 then
                UnitFramesPlusDB["global"]["mouseshow"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalMouseShow:SetChecked(true);
            end
        else
            UnitFramesPlusDB["global"]["mouseshow"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalMouseShow:SetChecked(false);
        end
        UnitFramesPlus_PetBarTextMouseShow();
        self:SetChecked(UnitFramesPlusDB["pet"]["mouseshow"]==1);
    end)

    --宠物头像内战斗信息
    local UnitFramesPlus_OptionsFrame_PetPortraitIndicator = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PetPortraitIndicator", UnitFramesPlus_Pet_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PetPortraitIndicator:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PetMouseShow, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PetPortraitIndicator:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PetPortraitIndicatorText:SetText(UFP_OP_Portrait_Indicator);
    UnitFramesPlus_OptionsFrame_PetPortraitIndicator:SetScript("OnClick", function(self)
        UnitFramesPlusDB["pet"]["indicator"] = 1 - UnitFramesPlusDB["pet"]["indicator"];
        UnitFramesPlus_PetPortraitIndicator();
        if UnitFramesPlusDB["pet"]["indicator"] == 1 then
            if UnitFramesPlusDB["player"]["indicator"] == 1 
            and UnitFramesPlusDB["target"]["indicator"] == 1 
            and UnitFramesPlusDB["focus"]["indicator"] == 1 
            and UnitFramesPlusDB["party"]["indicator"] == 1 then
                UnitFramesPlusDB["global"]["indicator"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalPortraitIndicator:SetChecked(true);
            end
        else
            UnitFramesPlusDB["global"]["indicator"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalPortraitIndicator:SetChecked(false);
        end
        self:SetChecked(UnitFramesPlusDB["pet"]["indicator"]==1);
    end)

    --目标设定
    local targetconfig = UnitFramesPlus_Target_Options:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge");
    targetconfig:SetPoint("TOPLEFT", 16, -16);
    targetconfig:SetText(UFP_OP_Target_Options);

    --目标生命值百分比
    local UnitFramesPlus_OptionsFrame_TargetHPPct = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_TargetHPPct", UnitFramesPlus_Target_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_TargetHPPct:SetPoint("TOPLEFT", targetconfig, "TOPLEFT", 0, -40);
    UnitFramesPlus_OptionsFrame_TargetHPPct:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_TargetHPPctText:SetText(UFP_OP_HPPct_Text);
    UnitFramesPlus_OptionsFrame_TargetHPPct:SetScript("OnClick", function(self)
        UnitFramesPlusDB["target"]["hppct"] = 1 - UnitFramesPlusDB["target"]["hppct"];
        UnitFramesPlus_TargetHealthPct();
        UnitFramesPlus_TargetHealthPctDisplayUpdate();
        self:SetChecked(UnitFramesPlusDB["target"]["hppct"]==1);
    end)

    --目标法力值百分比
    local UnitFramesPlus_OptionsFrame_TargetMPPct = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_TargetMPPct", UnitFramesPlus_Target_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_TargetMPPct:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetHPPct, "TOPLEFT", 180, 0);
    UnitFramesPlus_OptionsFrame_TargetMPPct:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_TargetMPPctText:SetText(UFP_OP_MPPct_Text);
    UnitFramesPlus_OptionsFrame_TargetMPPct:SetScript("OnClick", function(self)
        UnitFramesPlusDB["target"]["mppct"] = 1 - UnitFramesPlusDB["target"]["mppct"];
        UnitFramesPlus_TargetManaPct();
        UnitFramesPlus_TargetManaPctDisplayUpdate();
        self:SetChecked(UnitFramesPlusDB["target"]["mppct"]==1);
    end)

    --目标职业按钮
    local UnitFramesPlus_OptionsFrame_TargetClassIcon = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_TargetClassIcon", UnitFramesPlus_Target_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_TargetClassIcon:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetHPPct, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_TargetClassIcon:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_TargetClassIconText:SetText(UFP_OP_ClassIcon_Text);
    UnitFramesPlus_OptionsFrame_TargetClassIcon:SetScript("OnClick", function(self)
        UnitFramesPlusDB["target"]["classicon"] = 1 - UnitFramesPlusDB["target"]["classicon"];
        if UnitFramesPlusDB["target"]["classicon"] == 1 then
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_TargetClassIconMore);
            UnitFramesPlus_OptionsFrame_TargetClassIconMoreText:SetTextColor(1, 1, 1);
        else
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetClassIconMore);
        end
        UnitFramesPlus_TargetClassIcon();
        UnitFramesPlus_TargetClassIconDisplayUpdate();
        self:SetChecked(UnitFramesPlusDB["target"]["classicon"]==1);
    end)

    --职业图标左键观察，右键交易，中键密语，4键跟随
    local UnitFramesPlus_OptionsFrame_TargetClassIconMore = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_TargetClassIconMore", UnitFramesPlus_Target_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_TargetClassIconMore:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetClassIcon, "TOPLEFT", 180, 0);
    UnitFramesPlus_OptionsFrame_TargetClassIconMore:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_TargetClassIconMoreText:SetText(UFP_OP_ClassIcon_MoreAction);
    UnitFramesPlus_OptionsFrame_TargetClassIconMore:SetScript("OnClick", function(self)
        UnitFramesPlusDB["target"]["moreaction"] = 1 - UnitFramesPlusDB["target"]["moreaction"];
        self:SetChecked(UnitFramesPlusDB["target"]["moreaction"]==1);
    end)

    --目标种族或类型
    local UnitFramesPlus_OptionsFrame_TargetRace = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_TargetRace", UnitFramesPlus_Target_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_TargetRace:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetClassIcon, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_TargetRace:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_TargetRaceText:SetText(UFP_OP_Race_Text);
    UnitFramesPlus_OptionsFrame_TargetRace:SetScript("OnClick", function(self)
        UnitFramesPlusDB["target"]["race"] = 1 - UnitFramesPlusDB["target"]["race"];
        UnitFramesPlus_TargetRace();
        UnitFramesPlus_TargetRaceDisplayUpdate();
        self:SetChecked(UnitFramesPlusDB["target"]["race"]==1);
    end)

    --调节目标buff/debuff图标大小
    local UnitFramesPlus_OptionsFrame_TargetBuffSize = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_TargetBuffSize", UnitFramesPlus_Target_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_TargetBuffSize:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetRace, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_TargetBuffSize:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_TargetBuffSizeText:SetText(UFP_OP_Target_BuffSize);
    UnitFramesPlus_OptionsFrame_TargetBuffSize:SetScript("OnClick", function(self)
        UnitFramesPlusDB["target"]["buffsize"] = 1 - UnitFramesPlusDB["target"]["buffsize"];
        if UnitFramesPlusDB["target"]["buffsize"] == 1 then
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSlider);
            UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSliderText:SetTextColor(1, 1, 1);
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_TargetBuffSizeOtherSlider);
            UnitFramesPlus_OptionsFrame_TargetBuffSizeOtherSliderText:SetTextColor(1, 1, 1);
        else
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSlider);
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_TargetBuffSizeOtherSlider);
        end
        self:SetChecked(UnitFramesPlusDB["target"]["buffsize"]==1);
    end)

    --自己施放的buff/debuff大小
    local UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSlider = CreateFrame("Slider", "UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSlider", UnitFramesPlus_Target_Options, "OptionsSliderTemplate");
    UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSlider:SetWidth(95);
    UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSlider:SetHeight(16);
    UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSlider:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetBuffSize, "TOPLEFT", 30, -45);
    UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSliderText:SetText(UFP_OP_Target_MySize..UnitFramesPlusDB["target"]["mysize"]);
    UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSliderLow:SetText("8");
    UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSliderHigh:SetText("32");
    UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSlider:SetMinMaxValues(8,32);
    UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSlider:SetValueStep(1);
    UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSlider:SetObeyStepOnDrag(true);
    UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSlider:SetScript("OnValueChanged", function(self, value)
        UnitFramesPlusDB["target"]["mysize"] = value;
        UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSliderText:SetText(UFP_OP_Target_MySize..UnitFramesPlusDB["target"]["mysize"]);
    end)

    --其他人施放的buff/debuff大小
    local UnitFramesPlus_OptionsFrame_TargetBuffSizeOtherSlider = CreateFrame("Slider", "UnitFramesPlus_OptionsFrame_TargetBuffSizeOtherSlider", UnitFramesPlus_Target_Options, "OptionsSliderTemplate");
    UnitFramesPlus_OptionsFrame_TargetBuffSizeOtherSlider:SetWidth(95);
    UnitFramesPlus_OptionsFrame_TargetBuffSizeOtherSlider:SetHeight(16);
    UnitFramesPlus_OptionsFrame_TargetBuffSizeOtherSlider:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSlider, "TOPLEFT", 153, 0);
    UnitFramesPlus_OptionsFrame_TargetBuffSizeOtherSliderText:SetText(UFP_OP_Target_OtherSize..UnitFramesPlusDB["target"]["othersize"]);
    UnitFramesPlus_OptionsFrame_TargetBuffSizeOtherSliderLow:SetText("8");
    UnitFramesPlus_OptionsFrame_TargetBuffSizeOtherSliderHigh:SetText("32");
    UnitFramesPlus_OptionsFrame_TargetBuffSizeOtherSlider:SetMinMaxValues(8,32);
    UnitFramesPlus_OptionsFrame_TargetBuffSizeOtherSlider:SetValueStep(1);
    UnitFramesPlus_OptionsFrame_TargetBuffSizeOtherSlider:SetObeyStepOnDrag(true);
    UnitFramesPlus_OptionsFrame_TargetBuffSizeOtherSlider:SetScript("OnValueChanged", function(self, value)
        UnitFramesPlusDB["target"]["othersize"] = value;
        UnitFramesPlus_OptionsFrame_TargetBuffSizeOtherSliderText:SetText(UFP_OP_Target_OtherSize..UnitFramesPlusDB["target"]["othersize"]);
    end)

    --头像缩放
    local UnitFramesPlus_OptionsFrame_TargetFrameScaleSlider = CreateFrame("Slider", "UnitFramesPlus_OptionsFrame_TargetFrameScaleSlider", UnitFramesPlus_Target_Options, "OptionsSliderTemplate");
    UnitFramesPlus_OptionsFrame_TargetFrameScaleSlider:SetWidth(154);
    UnitFramesPlus_OptionsFrame_TargetFrameScaleSlider:SetHeight(16);
    UnitFramesPlus_OptionsFrame_TargetFrameScaleSlider:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSlider, "TOPLEFT", 0, -50);
    UnitFramesPlus_OptionsFrame_TargetFrameScaleSliderText:SetText(UFP_OP_Target_Scale..(UnitFramesPlusDB["target"]["scale"]*100).."%");
    UnitFramesPlus_OptionsFrame_TargetFrameScaleSliderLow:SetText("50%");
    UnitFramesPlus_OptionsFrame_TargetFrameScaleSliderHigh:SetText("150%");
    UnitFramesPlus_OptionsFrame_TargetFrameScaleSlider:SetMinMaxValues(50,150);
    UnitFramesPlus_OptionsFrame_TargetFrameScaleSlider:SetValueStep(1);
    UnitFramesPlus_OptionsFrame_TargetFrameScaleSlider:SetObeyStepOnDrag(true);
    UnitFramesPlus_OptionsFrame_TargetFrameScaleSlider:SetScript("OnValueChanged", function(self, value)
        UnitFramesPlus_TargetFrameScale(UnitFramesPlusDB["target"]["scale"], value/100);
        UnitFramesPlusDB["target"]["scale"] = value/100;
        UnitFramesPlus_OptionsFrame_TargetFrameScaleSliderText:SetText(UFP_OP_Target_Scale..(UnitFramesPlusDB["target"]["scale"]*100).."%");
    end)

    --鼠标移过时才显示数值
    local UnitFramesPlus_OptionsFrame_TargetMouseShow = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_TargetMouseShow", UnitFramesPlus_Target_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_TargetMouseShow:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetFrameScaleSlider, "TOPLEFT", -30, -35);
    UnitFramesPlus_OptionsFrame_TargetMouseShow:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_TargetMouseShowText:SetText(UFP_OP_Mouse_Show);
    UnitFramesPlus_OptionsFrame_TargetMouseShow:SetScript("OnClick", function(self)
        if tonumber(GetCVar("statusText")) ~= 1 then
            StaticPopup_Show("UFP_MOUSESHOW");
            self:SetChecked(UnitFramesPlusDB["target"]["mouseshow"]==1);
            return;
        end
        UnitFramesPlusDB["target"]["mouseshow"] = 1 - UnitFramesPlusDB["target"]["mouseshow"];
        if UnitFramesPlusDB["target"]["mouseshow"] == 1 then
            if UnitFramesPlusDB["player"]["mouseshow"] == 1 
            and UnitFramesPlusDB["pet"]["mouseshow"] == 1 
            and UnitFramesPlusDB["focus"]["mouseshow"] == 1 
            and UnitFramesPlusDB["party"]["mouseshow"] == 1 then
                UnitFramesPlusDB["global"]["mouseshow"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalMouseShow:SetChecked(true);
            end
        else
            UnitFramesPlusDB["global"]["mouseshow"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalMouseShow:SetChecked(false);
        end
        UnitFramesPlus_TargetBarTextMouseShow();
        self:SetChecked(UnitFramesPlusDB["target"]["mouseshow"]==1);
    end)

    --目标头像类型开关
    local UnitFramesPlus_OptionsFrame_TargetPortraitType = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_TargetPortraitType", UnitFramesPlus_Target_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_TargetPortraitType:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetMouseShow, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_TargetPortraitType:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_TargetPortraitTypeText:SetText(UFP_OP_Portrait);
    UnitFramesPlus_OptionsFrame_TargetPortraitType:SetScript("OnClick", function(self)
        UnitFramesPlusDB["target"]["portrait"] = 1 - UnitFramesPlusDB["target"]["portrait"];
        UnitFramesPlus_TargetPortrait();
        if UnitFramesPlusDB["target"]["portrait"] == 1 then
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_TargetPortraitTypeSlider);
            if UnitFramesPlusDB["target"]["ptype"] == 1 then
                BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_TargetPortrait3DBG);
                UnitFramesPlus_OptionsFrame_TargetPortrait3DBGText:SetTextColor(1, 1, 1);
            elseif UnitFramesPlusDB["target"]["ptype"] == 2 then
                BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_TargetPortraitNPCNo);
                UnitFramesPlus_OptionsFrame_TargetPortraitNPCNoText:SetTextColor(1, 1, 1);
            end
            if UnitFramesPlusDB["player"]["portrait"] == 1 
            and UnitFramesPlusDB["target"]["portrait"] == 1 
            and UnitFramesPlusDB["focus"]["portrait"] == 1 then
                UnitFramesPlusDB["global"]["portrait"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalPortraitType:SetChecked(true);
                BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSlider);
                if UnitFramesPlusDB["global"]["ptype"] == 1 then
                    BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG);
                    UnitFramesPlus_OptionsFrame_GlobalPortrait3DBGText:SetTextColor(1, 1, 1);
                elseif UnitFramesPlusDB["global"]["ptype"] == 2 then
                    BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo);
                end
            end
        else
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_TargetPortraitTypeSlider);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetPortrait3DBG);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetPortraitNPCNo);
            UnitFramesPlusDB["global"]["portrait"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalPortraitType:SetChecked(false);
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSlider);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo);
        end
        self:SetChecked(UnitFramesPlusDB["target"]["portrait"]==1);
    end)

    --目标头像类型
    local UnitFramesPlus_OptionsFrame_TargetPortraitTypeSlider = CreateFrame("Slider", "UnitFramesPlus_OptionsFrame_TargetPortraitTypeSlider", UnitFramesPlus_Target_Options, "OptionsSliderTemplate");
    UnitFramesPlus_OptionsFrame_TargetPortraitTypeSlider:SetWidth(95);
    UnitFramesPlus_OptionsFrame_TargetPortraitTypeSlider:SetHeight(16);
    UnitFramesPlus_OptionsFrame_TargetPortraitTypeSlider:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetPortraitType, "TOPLEFT", 183, 0);
    UnitFramesPlus_OptionsFrame_TargetPortraitTypeSliderLow:SetText(UFP_OP_3D);
    UnitFramesPlus_OptionsFrame_TargetPortraitTypeSliderHigh:SetText(UFP_OP_CLASS);
    UnitFramesPlus_OptionsFrame_TargetPortraitTypeSlider:SetMinMaxValues(1,2);
    UnitFramesPlus_OptionsFrame_TargetPortraitTypeSlider:SetValueStep(1);
    UnitFramesPlus_OptionsFrame_TargetPortraitTypeSlider:SetObeyStepOnDrag(true);
    UnitFramesPlus_OptionsFrame_TargetPortraitTypeSlider:SetScript("OnValueChanged", function(self, value)
        UnitFramesPlusDB["target"]["ptype"] = value;
        UnitFramesPlus_TargetPortrait();
        if value == 1 then
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_TargetPortrait3DBG);
            UnitFramesPlus_OptionsFrame_TargetPortrait3DBGText:SetTextColor(1, 1, 1);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetPortraitNPCNo);
        elseif value == 2 then
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetPortrait3DBG);
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_TargetPortraitNPCNo);
            UnitFramesPlus_OptionsFrame_TargetPortraitNPCNoText:SetTextColor(1, 1, 1);
        end
    end)

    --目标3D头像背景
    local UnitFramesPlus_OptionsFrame_TargetPortrait3DBG = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_TargetPortrait3DBG", UnitFramesPlus_Target_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_TargetPortrait3DBG:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetPortraitType, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_TargetPortrait3DBG:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_TargetPortrait3DBGText:SetText(UFP_OP_Portrait_3DBG);
    UnitFramesPlus_OptionsFrame_TargetPortrait3DBG:SetScript("OnClick", function(self)
        UnitFramesPlusDB["target"]["p3dbg"] = 1 - UnitFramesPlusDB["target"]["p3dbg"];
        UnitFramesPlus_TargetPortrait3DBGDisplayUpdate();
        if UnitFramesPlusDB["target"]["p3dbg"] == 1 then
            if UnitFramesPlusDB["player"]["p3dbg"] == 1 
            and UnitFramesPlusDB["focus"]["p3dbg"] == 1 then
                if UnitFramesPlusDB["global"]["portrait"] == 1 
                and UnitFramesPlusDB["global"]["ptype"] == 1 then
                    UnitFramesPlusDB["global"]["p3dbg"] = 1;
                    UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG:SetChecked(true);
                end
            end
        else
            UnitFramesPlusDB["global"]["p3dbg"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG:SetChecked(false);
        end
        self:SetChecked(UnitFramesPlusDB["target"]["p3dbg"]==1);
    end)

    --目标为NPC时不显示职业头像
    local UnitFramesPlus_OptionsFrame_TargetPortraitNPCNo = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_TargetPortraitNPCNo", UnitFramesPlus_Target_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_TargetPortraitNPCNo:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetPortrait3DBG, "TOPLEFT", 180, 0);
    UnitFramesPlus_OptionsFrame_TargetPortraitNPCNo:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_TargetPortraitNPCNoText:SetText(UFP_OP_NPCNo);
    UnitFramesPlus_OptionsFrame_TargetPortraitNPCNo:SetScript("OnClick", function(self)
        UnitFramesPlusDB["target"]["npcno"] = 1 - UnitFramesPlusDB["target"]["npcno"];
        UnitFramesPlus_TargetPortraitDisplayUpdate();
        if UnitFramesPlusDB["target"]["npcno"] == 1 then
            if UnitFramesPlusDB["focus"]["npcno"] == 1 then
                if UnitFramesPlusDB["global"]["portrait"] == 1 
                and UnitFramesPlusDB["global"]["ptype"] == 2 then
                    UnitFramesPlusDB["global"]["npcno"] = 1;
                    UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo:SetChecked(true);
                end
            end
        else
            UnitFramesPlusDB["global"]["npcno"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo:SetChecked(false);
        end
        self:SetChecked(UnitFramesPlusDB["target"]["npcno"]==1);
    end)

    --Shift拖动头像
    local UnitFramesPlus_OptionsFrame_TargetShiftDrag = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_TargetShiftDrag", UnitFramesPlus_Target_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_TargetShiftDrag:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetPortrait3DBG, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_TargetShiftDrag:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_TargetShiftDragText:SetText(UFP_OP_Shift_Movable);
    UnitFramesPlus_OptionsFrame_TargetShiftDrag:SetScript("OnClick", function(self)
        UnitFramesPlusDB["target"]["movable"] = 1 - UnitFramesPlusDB["target"]["movable"];
        if UnitFramesPlusDB["target"]["movable"] == 1 then
            if UnitFramesPlusDB["player"]["movable"] == 1 
            and UnitFramesPlusDB["focus"]["movable"] == 1 
            and UnitFramesPlusDB["party"]["movable"] == 1 then
                UnitFramesPlusDB["global"]["movable"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalShiftDrag:SetChecked(true);
            end
        else
            UnitFramesPlusDB["global"]["movable"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalShiftDrag:SetChecked(false);
        end
        self:SetChecked(UnitFramesPlusDB["target"]["movable"]==1);
    end)

    --目标头像内战斗信息
    local UnitFramesPlus_OptionsFrame_TargetPortraitIndicator = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_TargetPortraitIndicator", UnitFramesPlus_Target_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_TargetPortraitIndicator:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetShiftDrag, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_TargetPortraitIndicator:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_TargetPortraitIndicatorText:SetText(UFP_OP_Portrait_Indicator);
    UnitFramesPlus_OptionsFrame_TargetPortraitIndicator:SetScript("OnClick", function(self)
        UnitFramesPlusDB["target"]["indicator"] = 1 - UnitFramesPlusDB["target"]["indicator"];
        UnitFramesPlus_TargetPortraitIndicator();
        if UnitFramesPlusDB["target"]["indicator"] == 1 then
            if UnitFramesPlusDB["player"]["indicator"] == 1 
            and UnitFramesPlusDB["pet"]["indicator"] == 1 
            and UnitFramesPlusDB["focus"]["indicator"] == 1 
            and UnitFramesPlusDB["party"]["indicator"] == 1 then
                UnitFramesPlusDB["global"]["indicator"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalPortraitIndicator:SetChecked(true);
            end
        else
            UnitFramesPlusDB["global"]["indicator"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalPortraitIndicator:SetChecked(false);
        end
        self:SetChecked(UnitFramesPlusDB["target"]["indicator"]==1);
    end)

    --目标生命条染色
    local UnitFramesPlus_OptionsFrame_TargetColorHP = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_TargetColorHP", UnitFramesPlus_Target_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_TargetColorHP:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetPortraitIndicator, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_TargetColorHP:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_TargetColorHPText:SetText(UFP_OP_ColorHP_Text);
    UnitFramesPlus_OptionsFrame_TargetColorHP:SetScript("OnClick", function(self)
        UnitFramesPlusDB["target"]["colorhp"] = 1 - UnitFramesPlusDB["target"]["colorhp"];
        if UnitFramesPlusDB["target"]["colorhp"] == 1 then
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_TargetColorHPSlider);
        else
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_TargetColorHPSlider);
        end
        UnitFramesPlus_TargetColorHPBar();
        UnitFramesPlus_TargetColorHPBarDisplayUpdate();
        if UnitFramesPlusDB["target"]["colorhp"] == 1 then
            if UnitFramesPlusDB["player"]["colorhp"] == 1 
            and UnitFramesPlusDB["focus"]["colorhp"] == 1 
            and UnitFramesPlusDB["party"]["colorhp"] == 1 then
                UnitFramesPlusDB["global"]["colorhp"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalColorHP:SetChecked(true);
                BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_GlobalColorHPSlider);
            end
        else
            UnitFramesPlusDB["global"]["colorhp"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalColorHP:SetChecked(false);
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_GlobalColorHPSlider);
        end
        self:SetChecked(UnitFramesPlusDB["target"]["colorhp"]==1);
    end)

    --生命条染色类型
    local UnitFramesPlus_OptionsFrame_TargetColorHPSlider = CreateFrame("Slider", "UnitFramesPlus_OptionsFrame_TargetColorHPSlider", UnitFramesPlus_Target_Options, "OptionsSliderTemplate");
    UnitFramesPlus_OptionsFrame_TargetColorHPSlider:SetWidth(95);
    UnitFramesPlus_OptionsFrame_TargetColorHPSlider:SetHeight(16);
    UnitFramesPlus_OptionsFrame_TargetColorHPSlider:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetColorHP, "TOPLEFT", 183, 0);
    UnitFramesPlus_OptionsFrame_TargetColorHPSliderLow:SetText(UFP_OP_ColorHP_Class);
    UnitFramesPlus_OptionsFrame_TargetColorHPSliderHigh:SetText(UFP_OP_ColorHP_HPPct);
    UnitFramesPlus_OptionsFrame_TargetColorHPSlider:SetMinMaxValues(1,2);
    UnitFramesPlus_OptionsFrame_TargetColorHPSlider:SetValueStep(1);
    UnitFramesPlus_OptionsFrame_TargetColorHPSlider:SetObeyStepOnDrag(true);
    UnitFramesPlus_OptionsFrame_TargetColorHPSlider:SetScript("OnValueChanged", function(self, value)
        UnitFramesPlusDB["target"]["colortype"] = value;
        UnitFramesPlus_TargetColorHPBar();
        UnitFramesPlus_TargetColorHPBarDisplayUpdate();
    end)

    --目标的目标设定
    local totconfig = UnitFramesPlus_TargetTarget_Options:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge");
    totconfig:SetPoint("TOPLEFT", 16, -16);
    totconfig:SetText(UFP_OP_ToT_Options);

    --系统ToT状态
    local UnitFramesPlus_OptionsFrame_TargetSYSToT = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_TargetSYSToT", UnitFramesPlus_TargetTarget_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_TargetSYSToT:SetPoint("TOPLEFT", totconfig, "TOPLEFT", 0, -40);
    UnitFramesPlus_OptionsFrame_TargetSYSToT:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_TargetSYSToTText:SetText(UFP_OP_Target_SYSToT);
    UnitFramesPlus_OptionsFrame_TargetSYSToT:SetScript("OnClick", function(self)
        --InterfaceOptionsFrame_OpenToCategory(InterfaceOptionsCombatPanel);
        InterfaceOptionsFrame:Hide();
        GameMenuButtonUIOptions:Click();
        InterfaceOptionsFrameCategoriesButton2:Click();
        self:SetChecked(tonumber(GetCVar("showTargetOfTarget"))==1);
        -- rl = "systot";
        -- StaticPopup_Show("UFP_RELOADUI");
        -- self:SetChecked(UnitFramesPlusDB["target"]["systot"]==1);
    end)

    --在进入游戏时自动关闭系统目标的目标
    local UnitFramesPlus_OptionsFrame_TargetAutoToT = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_TargetAutoToT", UnitFramesPlus_TargetTarget_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_TargetAutoToT:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetSYSToT, "TOPLEFT", 180, 0);
    UnitFramesPlus_OptionsFrame_TargetAutoToT:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_TargetAutoToTText:SetText(UFP_OP_Target_AutoToT);
    UnitFramesPlus_OptionsFrame_TargetAutoToT:SetScript("OnClick", function(self)
        UnitFramesPlusDB["target"]["systot"] = 1 - UnitFramesPlusDB["target"]["systot"];
        self:SetChecked(UnitFramesPlusDB["target"]["systot"]==1);
    end)

    --目标的目标
    local UnitFramesPlus_OptionsFrame_TargetToT = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_TargetToT", UnitFramesPlus_TargetTarget_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_TargetToT:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetSYSToT, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_TargetToT:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_TargetToTText:SetText(UFP_OP_Target_ToT);
    UnitFramesPlus_OptionsFrame_TargetToT:SetScript("OnClick", function(self)
        UnitFramesPlusDB["target"]["tot"] = 1 - UnitFramesPlusDB["target"]["tot"];
        if UnitFramesPlusDB["target"]["tot"] == 1 then
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_TargetToToT);
            UnitFramesPlus_OptionsFrame_TargetToToTText:SetTextColor(1, 1, 1);
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_TargetToTDebuff);
            UnitFramesPlus_OptionsFrame_TargetToTDebuffText:SetTextColor(1, 1, 1);
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_TargetToTScaleSlider);
            UnitFramesPlus_OptionsFrame_TargetToTScaleSliderText:SetTextColor(1, 1, 1);
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_TargetToTHPPct);
            UnitFramesPlus_OptionsFrame_TargetToTHPPctText:SetTextColor(1, 1, 1);
        else
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetToToT);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetToTDebuff);
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_TargetToTScaleSlider);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetToTHPPct);
        end
        UnitFramesPlus_TargetTarget();
        UnitFramesPlus_TargetTargetTarget();
        self:SetChecked(UnitFramesPlusDB["target"]["tot"]==1);
    end)

    --目标的目标的目标
    local UnitFramesPlus_OptionsFrame_TargetToToT = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_TargetToToT", UnitFramesPlus_TargetTarget_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_TargetToToT:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetToT, "TOPLEFT", 180, 0);
    UnitFramesPlus_OptionsFrame_TargetToToT:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_TargetToToTText:SetText(UFP_OP_Target_ToToT);
    UnitFramesPlus_OptionsFrame_TargetToToT:SetScript("OnClick", function(self)
        UnitFramesPlusDB["target"]["totot"] = 1 - UnitFramesPlusDB["target"]["totot"];
        UnitFramesPlus_TargetTargetTarget();
        self:SetChecked(UnitFramesPlusDB["target"]["totot"]==1);
    end)

    --目标的目标debuff
    local UnitFramesPlus_OptionsFrame_TargetToTDebuff = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_TargetToTDebuff", UnitFramesPlus_TargetTarget_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_TargetToTDebuff:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetToT, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_TargetToTDebuff:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_TargetToTDebuffText:SetText(UFP_OP_Target_Debuff);
    UnitFramesPlus_OptionsFrame_TargetToTDebuff:SetScript("OnClick", function(self)
        UnitFramesPlusDB["target"]["debuff"] = 1 - UnitFramesPlusDB["target"]["debuff"];
        UnitFramesPlus_TargetTargetDebuff();
        self:SetChecked(UnitFramesPlusDB["target"]["debuff"]==1);
    end)

    --目标的目标生命值百分比
    local UnitFramesPlus_OptionsFrame_TargetToTHPPct = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_TargetToTHPPct", UnitFramesPlus_TargetTarget_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_TargetToTHPPct:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetToTDebuff, "TOPLEFT", 180, 0);
    UnitFramesPlus_OptionsFrame_TargetToTHPPct:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_TargetToTHPPctText:SetText(UFP_OP_Target_ToTHPPct);
    UnitFramesPlus_OptionsFrame_TargetToTHPPct:SetScript("OnClick", function(self)
        UnitFramesPlusDB["target"]["tothppct"] = 1 - UnitFramesPlusDB["target"]["tothppct"];
        self:SetChecked(UnitFramesPlusDB["target"]["tothppct"]==1);
    end)

    --目标的目标缩放
    local UnitFramesPlus_OptionsFrame_TargetToTScaleSlider = CreateFrame("Slider", "UnitFramesPlus_OptionsFrame_TargetToTScaleSlider", UnitFramesPlus_TargetTarget_Options, "OptionsSliderTemplate");
    UnitFramesPlus_OptionsFrame_TargetToTScaleSlider:SetWidth(154);
    UnitFramesPlus_OptionsFrame_TargetToTScaleSlider:SetHeight(16);
    UnitFramesPlus_OptionsFrame_TargetToTScaleSlider:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_TargetToTDebuff, "TOPLEFT", 30, -45);
    UnitFramesPlus_OptionsFrame_TargetToTScaleSliderText:SetText(UFP_OP_Target_ToTScale..(UnitFramesPlusDB["target"]["tscale"]*100).."%");
    UnitFramesPlus_OptionsFrame_TargetToTScaleSliderLow:SetText("50%");
    UnitFramesPlus_OptionsFrame_TargetToTScaleSliderHigh:SetText("150%");
    UnitFramesPlus_OptionsFrame_TargetToTScaleSlider:SetMinMaxValues(50,150);
    UnitFramesPlus_OptionsFrame_TargetToTScaleSlider:SetValueStep(1);
    UnitFramesPlus_OptionsFrame_TargetToTScaleSlider:SetObeyStepOnDrag(true);
    UnitFramesPlus_OptionsFrame_TargetToTScaleSlider:SetScript("OnValueChanged", function(self, value)
        UnitFramesPlus_TargetTargetScale(UnitFramesPlusDB["target"]["tscale"], value/100);
        UnitFramesPlusDB["target"]["tscale"] = value/100;
        UnitFramesPlus_OptionsFrame_TargetToTScaleSliderText:SetText(UFP_OP_Target_ToTScale..(UnitFramesPlusDB["target"]["tscale"]*100).."%");
    end)

    --焦点设定
    local focusconfig = UnitFramesPlus_Focus_Options:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge");
    focusconfig:SetPoint("TOPLEFT", 16, -16);
    focusconfig:SetText(UFP_OP_Focus_Options);

    --焦点生命值百分比
    local UnitFramesPlus_OptionsFrame_FocusHPPct = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_FocusHPPct", UnitFramesPlus_Focus_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_FocusHPPct:SetPoint("TOPLEFT", focusconfig, "TOPLEFT", 0, -40);
    UnitFramesPlus_OptionsFrame_FocusHPPct:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_FocusHPPctText:SetText(UFP_OP_HPPct_Text);
    UnitFramesPlus_OptionsFrame_FocusHPPct:SetScript("OnClick", function(self)
        UnitFramesPlusDB["focus"]["hppct"] = 1 - UnitFramesPlusDB["focus"]["hppct"];
        UnitFramesPlus_FocusHealthPct();
        UnitFramesPlus_FocusHealthPctDisplayUpdate();
        self:SetChecked(UnitFramesPlusDB["focus"]["hppct"]==1);
    end)

    --焦点法力值百分比
    local UnitFramesPlus_OptionsFrame_FocusMPPct = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_FocusMPPct", UnitFramesPlus_Focus_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_FocusMPPct:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_FocusHPPct, "TOPLEFT", 180, 0);
    UnitFramesPlus_OptionsFrame_FocusMPPct:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_FocusMPPctText:SetText(UFP_OP_MPPct_Text);
    UnitFramesPlus_OptionsFrame_FocusMPPct:SetScript("OnClick", function(self)
        UnitFramesPlusDB["focus"]["mppct"] = 1 - UnitFramesPlusDB["focus"]["mppct"];
        UnitFramesPlus_FocusManaPct();
        UnitFramesPlus_FocusManaPctDisplayUpdate();
        self:SetChecked(UnitFramesPlusDB["focus"]["mppct"]==1);
    end)

    --焦点职业图标
    local UnitFramesPlus_OptionsFrame_FocusClassIcon = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_FocusClassIcon", UnitFramesPlus_Focus_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_FocusClassIcon:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_FocusHPPct, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_FocusClassIcon:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_FocusClassIconText:SetText(UFP_OP_ClassIcon_Text);
    UnitFramesPlus_OptionsFrame_FocusClassIcon:SetScript("OnClick", function(self)
        UnitFramesPlusDB["focus"]["classicon"] = 1 - UnitFramesPlusDB["focus"]["classicon"];
        if UnitFramesPlusDB["focus"]["classicon"] == 1 then
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_FocusClassIconMore);
            UnitFramesPlus_OptionsFrame_FocusClassIconMoreText:SetTextColor(1, 1, 1);
        else
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_FocusClassIconMore);
        end
        UnitFramesPlus_FocusClassIcon();
        UnitFramesPlus_FocusClassIconDisplayUpdate();
        self:SetChecked(UnitFramesPlusDB["focus"]["classicon"]==1);
    end)

    --职业图标左键观察，右键交易，中键密语，4键跟随
    local UnitFramesPlus_OptionsFrame_FocusClassIconMore = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_FocusClassIconMore", UnitFramesPlus_Focus_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_FocusClassIconMore:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_FocusClassIcon, "TOPLEFT", 180, 0);
    UnitFramesPlus_OptionsFrame_FocusClassIconMore:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_FocusClassIconMoreText:SetText(UFP_OP_ClassIcon_MoreAction);
    UnitFramesPlus_OptionsFrame_FocusClassIconMore:SetScript("OnClick", function(self)
        UnitFramesPlusDB["focus"]["moreaction"] = 1 - UnitFramesPlusDB["focus"]["moreaction"];
        self:SetChecked(UnitFramesPlusDB["focus"]["moreaction"]==1);
    end)

    --焦点种族或类型
    local UnitFramesPlus_OptionsFrame_FocusRace = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_FocusRace", UnitFramesPlus_Focus_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_FocusRace:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_FocusClassIcon, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_FocusRace:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_FocusRaceText:SetText(UFP_OP_Race_Text);
    UnitFramesPlus_OptionsFrame_FocusRace:SetScript("OnClick", function(self)
        UnitFramesPlusDB["focus"]["race"] = 1 - UnitFramesPlusDB["focus"]["race"];
        UnitFramesPlus_FocusRace();
        UnitFramesPlus_FocusRaceDisplayUpdate();
        self:SetChecked(UnitFramesPlusDB["focus"]["race"]==1);
    end)

    --快速焦点
    local UnitFramesPlus_OptionsFrame_FocusQuick = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_FocusQuick", UnitFramesPlus_Focus_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_FocusQuick:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_FocusRace, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_FocusQuick:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_FocusQuickText:SetText(UFP_OP_Focus_QuickFocus);
    UnitFramesPlus_OptionsFrame_FocusQuick:SetScript("OnClick", function(self)
        UnitFramesPlusDB["focus"]["quick"] = 1 - UnitFramesPlusDB["focus"]["quick"];
        if UnitFramesPlusDB["focus"]["quick"] == 1 then
            UIDropDownMenu_EnableDropDown(UnitFramesPlus_OptionsFrame_FocusQuickDropDown);
        else
            UIDropDownMenu_DisableDropDown(UnitFramesPlus_OptionsFrame_FocusQuickDropDown);
        end
        UnitFramesPlus_FocusQuick();
        self:SetChecked(UnitFramesPlusDB["focus"]["quick"]==1);
    end)

    --快速焦点快捷键
    local UnitFramesPlus_OptionsFrame_FocusQuickDropDown = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_FocusQuickDropDown", UnitFramesPlus_Focus_Options, "UIDropDownMenuTemplate");
    UnitFramesPlus_OptionsFrame_FocusQuickDropDown:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_FocusQuick, "TOPLEFT", 165, 0);
    UnitFramesPlus_OptionsFrame_FocusQuickDropDown:SetHitRectInsets(0, -100, 0, 0);
    UIDropDownMenu_SetWidth(UnitFramesPlus_OptionsFrame_FocusQuickDropDown, 95);
    UIDropDownMenu_Initialize(UnitFramesPlus_OptionsFrame_FocusQuickDropDown, QuickFocus_Init);
    UIDropDownMenu_SetSelectedID(UnitFramesPlus_OptionsFrame_FocusQuickDropDown, UnitFramesPlusDB["focus"]["button"]);

    --焦点头像缩放
    local UnitFramesPlus_OptionsFrame_FocusFrameScaleSlider = CreateFrame("Slider", "UnitFramesPlus_OptionsFrame_FocusFrameScaleSlider", UnitFramesPlus_Focus_Options, "OptionsSliderTemplate");
    UnitFramesPlus_OptionsFrame_FocusFrameScaleSlider:SetWidth(154);
    UnitFramesPlus_OptionsFrame_FocusFrameScaleSlider:SetHeight(16);
    UnitFramesPlus_OptionsFrame_FocusFrameScaleSlider:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_FocusQuick, "TOPLEFT", 30, -45);
    UnitFramesPlus_OptionsFrame_FocusFrameScaleSliderText:SetText(UFP_OP_Focus_Scale..(UnitFramesPlusDB["focus"]["scale"]*100).."%");
    UnitFramesPlus_OptionsFrame_FocusFrameScaleSliderLow:SetText("50%");
    UnitFramesPlus_OptionsFrame_FocusFrameScaleSliderHigh:SetText("150%");
    UnitFramesPlus_OptionsFrame_FocusFrameScaleSlider:SetMinMaxValues(50,150);
    UnitFramesPlus_OptionsFrame_FocusFrameScaleSlider:SetValueStep(1);
    UnitFramesPlus_OptionsFrame_FocusFrameScaleSlider:SetObeyStepOnDrag(true);
    UnitFramesPlus_OptionsFrame_FocusFrameScaleSlider:SetScript("OnValueChanged", function(self, value)
        UnitFramesPlus_FocusFrameScale(UnitFramesPlusDB["focus"]["scale"], value/100);
        UnitFramesPlusDB["focus"]["scale"] = value/100;
        UnitFramesPlus_OptionsFrame_FocusFrameScaleSliderText:SetText(UFP_OP_Focus_Scale..(UnitFramesPlusDB["focus"]["scale"]*100).."%");
    end)

    --焦点目标
    local UnitFramesPlus_OptionsFrame_FocusToF = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_FocusToF", UnitFramesPlus_Focus_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_FocusToF:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_FocusFrameScaleSlider, "TOPLEFT", -30, -35);
    UnitFramesPlus_OptionsFrame_FocusToF:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_FocusToFText:SetText(UFP_OP_Focus_ToF);
    UnitFramesPlus_OptionsFrame_FocusToF:SetScript("OnClick", function(self)
        UnitFramesPlusDB["focus"]["tof"] = 1 - UnitFramesPlusDB["focus"]["tof"];
        if UnitFramesPlusDB["focus"]["tof"] == 1 then
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_FocusToFScaleSlider);
            UnitFramesPlus_OptionsFrame_FocusToFScaleSliderText:SetTextColor(1, 1, 1);
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_FocusToFHPPct);
            UnitFramesPlus_OptionsFrame_FocusToFHPPctText:SetTextColor(1, 1, 1);
        else
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_FocusToFScaleSlider);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_FocusToFHPPct);
        end
        UnitFramesPlus_FocusTarget();
        self:SetChecked(UnitFramesPlusDB["focus"]["tof"]==1);
    end)

    --焦点目标生命值百分比
    local UnitFramesPlus_OptionsFrame_FocusToFHPPct = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_FocusToFHPPct", UnitFramesPlus_Focus_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_FocusToFHPPct:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_FocusToF, "TOPLEFT", 180, 0);
    UnitFramesPlus_OptionsFrame_FocusToFHPPct:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_FocusToFHPPctText:SetText(UFP_OP_Focus_ToFHPPct);
    UnitFramesPlus_OptionsFrame_FocusToFHPPct:SetScript("OnClick", function(self)
        UnitFramesPlusDB["focus"]["tofhppct"] = 1 - UnitFramesPlusDB["focus"]["tofhppct"];
        self:SetChecked(UnitFramesPlusDB["focus"]["tofhppct"]==1);
    end)

    --焦点目标缩放
    local UnitFramesPlus_OptionsFrame_FocusToFScaleSlider = CreateFrame("Slider", "UnitFramesPlus_OptionsFrame_FocusToFScaleSlider", UnitFramesPlus_Focus_Options, "OptionsSliderTemplate");
    UnitFramesPlus_OptionsFrame_FocusToFScaleSlider:SetWidth(154);
    UnitFramesPlus_OptionsFrame_FocusToFScaleSlider:SetHeight(16);
    UnitFramesPlus_OptionsFrame_FocusToFScaleSlider:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_FocusToF, "TOPLEFT", 30, -45);
    UnitFramesPlus_OptionsFrame_FocusToFScaleSliderText:SetText(UFP_OP_Focus_ToFScale..(UnitFramesPlusDB["focus"]["tscale"]*100).."%");
    UnitFramesPlus_OptionsFrame_FocusToFScaleSliderLow:SetText("50%");
    UnitFramesPlus_OptionsFrame_FocusToFScaleSliderHigh:SetText("150%");
    UnitFramesPlus_OptionsFrame_FocusToFScaleSlider:SetMinMaxValues(50,150);
    UnitFramesPlus_OptionsFrame_FocusToFScaleSlider:SetValueStep(1);
    UnitFramesPlus_OptionsFrame_FocusToFScaleSlider:SetObeyStepOnDrag(true);
    UnitFramesPlus_OptionsFrame_FocusToFScaleSlider:SetScript("OnValueChanged", function(self, value)
        UnitFramesPlus_FocusTargetScale(UnitFramesPlusDB["focus"]["tscale"], value/100);
        UnitFramesPlusDB["focus"]["tscale"] = value/100;
        UnitFramesPlus_OptionsFrame_FocusToFScaleSliderText:SetText(UFP_OP_Focus_ToFScale..(UnitFramesPlusDB["focus"]["tscale"]*100).."%");
    end)

    --鼠标移过时才显示数值
    local UnitFramesPlus_OptionsFrame_FocusMouseShow = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_FocusMouseShow", UnitFramesPlus_Focus_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_FocusMouseShow:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_FocusToFScaleSlider, "TOPLEFT", -30, -35);
    UnitFramesPlus_OptionsFrame_FocusMouseShow:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_FocusMouseShowText:SetText(UFP_OP_Mouse_Show);
    UnitFramesPlus_OptionsFrame_FocusMouseShow:SetScript("OnClick", function(self)
        if tonumber(GetCVar("statusText")) ~= 1 then
            StaticPopup_Show("UFP_MOUSESHOW");
            self:SetChecked(UnitFramesPlusDB["focus"]["mouseshow"]==1);
            return;
        end
        UnitFramesPlusDB["focus"]["mouseshow"] = 1 - UnitFramesPlusDB["focus"]["mouseshow"];
        if UnitFramesPlusDB["focus"]["mouseshow"] == 1 then
            if UnitFramesPlusDB["player"]["mouseshow"] == 1 
            and UnitFramesPlusDB["pet"]["mouseshow"] == 1 
            and UnitFramesPlusDB["target"]["mouseshow"] == 1 
            and UnitFramesPlusDB["party"]["mouseshow"] == 1 then
                UnitFramesPlusDB["global"]["mouseshow"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalMouseShow:SetChecked(true);
            end
        else
            UnitFramesPlusDB["global"]["mouseshow"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalMouseShow:SetChecked(false);
        end
        UnitFramesPlus_FocusBarTextMouseShow();
        self:SetChecked(UnitFramesPlusDB["focus"]["mouseshow"]==1);
    end)

    --玩家头像类型开关
    local UnitFramesPlus_OptionsFrame_FocusPortraitType = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_FocusPortraitType", UnitFramesPlus_Focus_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_FocusPortraitType:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_FocusMouseShow, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_FocusPortraitType:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_FocusPortraitTypeText:SetText(UFP_OP_Portrait);
    UnitFramesPlus_OptionsFrame_FocusPortraitType:SetScript("OnClick", function(self)
        UnitFramesPlusDB["focus"]["portrait"] = 1 - UnitFramesPlusDB["focus"]["portrait"];
        UnitFramesPlus_FocusPortrait();
        if UnitFramesPlusDB["focus"]["portrait"] == 1 then
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_FocusPortraitTypeSlider);
            if UnitFramesPlusDB["focus"]["ptype"] == 1 then
                BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_FocusPortrait3DBG);
                UnitFramesPlus_OptionsFrame_FocusPortrait3DBGText:SetTextColor(1, 1, 1);
            elseif UnitFramesPlusDB["focus"]["ptype"] == 2 then
                BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_FocusPortraitNPCNo);
                UnitFramesPlus_OptionsFrame_FocusPortraitNPCNoText:SetTextColor(1, 1, 1);
            end
            if UnitFramesPlusDB["player"]["portrait"] == 1 
            and UnitFramesPlusDB["target"]["portrait"] == 1 
            and UnitFramesPlusDB["focus"]["portrait"] == 1 then
                UnitFramesPlusDB["global"]["portrait"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalPortraitType:SetChecked(true);
                BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSlider);
                if UnitFramesPlusDB["global"]["ptype"] == 1 then
                    BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG);
                    UnitFramesPlus_OptionsFrame_GlobalPortrait3DBGText:SetTextColor(1, 1, 1);
                elseif UnitFramesPlusDB["global"]["ptype"] == 2 then
                    BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo);
                end
            end
        else
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_FocusPortraitTypeSlider);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_FocusPortrait3DBG);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_FocusPortraitNPCNo);
            UnitFramesPlusDB["global"]["portrait"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalPortraitType:SetChecked(false);
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSlider);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo);
        end
        self:SetChecked(UnitFramesPlusDB["focus"]["portrait"]==1);
    end)

    --玩家头像类型
    local UnitFramesPlus_OptionsFrame_FocusPortraitTypeSlider = CreateFrame("Slider", "UnitFramesPlus_OptionsFrame_FocusPortraitTypeSlider", UnitFramesPlus_Focus_Options, "OptionsSliderTemplate");
    UnitFramesPlus_OptionsFrame_FocusPortraitTypeSlider:SetWidth(95);
    UnitFramesPlus_OptionsFrame_FocusPortraitTypeSlider:SetHeight(16);
    UnitFramesPlus_OptionsFrame_FocusPortraitTypeSlider:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_FocusPortraitType, "TOPLEFT", 183, 0);
    UnitFramesPlus_OptionsFrame_FocusPortraitTypeSliderLow:SetText(UFP_OP_3D);
    UnitFramesPlus_OptionsFrame_FocusPortraitTypeSliderHigh:SetText(UFP_OP_CLASS);
    UnitFramesPlus_OptionsFrame_FocusPortraitTypeSlider:SetMinMaxValues(1,2);
    UnitFramesPlus_OptionsFrame_FocusPortraitTypeSlider:SetValueStep(1);
    UnitFramesPlus_OptionsFrame_FocusPortraitTypeSlider:SetObeyStepOnDrag(true);
    UnitFramesPlus_OptionsFrame_FocusPortraitTypeSlider:SetScript("OnValueChanged", function(self, value)
        UnitFramesPlusDB["focus"]["ptype"] = value;
        UnitFramesPlus_FocusPortrait();
        if value == 1 then
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_FocusPortrait3DBG);
            UnitFramesPlus_OptionsFrame_FocusPortrait3DBGText:SetTextColor(1, 1, 1);
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_FocusPortraitNPCNo);
        elseif value == 2 then
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_FocusPortrait3DBG);
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_FocusPortraitNPCNo);
            UnitFramesPlus_OptionsFrame_FocusPortraitNPCNoText:SetTextColor(1, 1, 1);
        end
    end)

    --焦点3D头像背景
    local UnitFramesPlus_OptionsFrame_FocusPortrait3DBG = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_FocusPortrait3DBG", UnitFramesPlus_Focus_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_FocusPortrait3DBG:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_FocusPortraitType, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_FocusPortrait3DBG:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_FocusPortrait3DBGText:SetText(UFP_OP_Portrait_3DBG);
    UnitFramesPlus_OptionsFrame_FocusPortrait3DBG:SetScript("OnClick", function(self)
        UnitFramesPlusDB["focus"]["p3dbg"] = 1 - UnitFramesPlusDB["focus"]["p3dbg"];
        UnitFramesPlus_FocusPortrait3DBGDisplayUpdate();
        if UnitFramesPlusDB["focus"]["p3dbg"] == 1 then
            if UnitFramesPlusDB["player"]["p3dbg"] == 1 
            and UnitFramesPlusDB["target"]["p3dbg"] == 1 then
                if UnitFramesPlusDB["global"]["portrait"] == 1 
                and UnitFramesPlusDB["global"]["ptype"] == 1 then
                    UnitFramesPlusDB["global"]["p3dbg"] = 1;
                    UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG:SetChecked(true);
                end
            end
        else
            UnitFramesPlusDB["global"]["p3dbg"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG:SetChecked(false);
        end
        self:SetChecked(UnitFramesPlusDB["focus"]["p3dbg"]==1);
    end)

    --焦点为NPC时不显示职业头像
    local UnitFramesPlus_OptionsFrame_FocusPortraitNPCNo = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_FocusPortraitNPCNo", UnitFramesPlus_Focus_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_FocusPortraitNPCNo:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_FocusPortrait3DBG, "TOPLEFT", 180, 0);
    UnitFramesPlus_OptionsFrame_FocusPortraitNPCNo:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_FocusPortraitNPCNoText:SetText(UFP_OP_NPCNo);
    UnitFramesPlus_OptionsFrame_FocusPortraitNPCNo:SetScript("OnClick", function(self)
        UnitFramesPlusDB["focus"]["npcno"] = 1 - UnitFramesPlusDB["focus"]["npcno"];
        UnitFramesPlus_FocusPortraitDisplayUpdate();
        if UnitFramesPlusDB["focus"]["npcno"] == 1 then
            if UnitFramesPlusDB["target"]["npcno"] == 1 then
                if UnitFramesPlusDB["global"]["portrait"] == 1 
                and UnitFramesPlusDB["global"]["ptype"] == 2 then
                    UnitFramesPlusDB["global"]["npcno"] = 1;
                    UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo:SetChecked(true);
                end
            end
        else
            UnitFramesPlusDB["global"]["npcno"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo:SetChecked(false);
        end
        self:SetChecked(UnitFramesPlusDB["focus"]["npcno"]==1);
    end)

    --Shift拖动头像
    local UnitFramesPlus_OptionsFrame_FocusShiftDrag = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_FocusShiftDrag", UnitFramesPlus_Focus_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_FocusShiftDrag:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_FocusPortrait3DBG, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_FocusShiftDrag:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_FocusShiftDragText:SetText(UFP_OP_Shift_Movable);
    UnitFramesPlus_OptionsFrame_FocusShiftDrag:SetScript("OnClick", function(self)
        UnitFramesPlusDB["focus"]["movable"] = 1 - UnitFramesPlusDB["focus"]["movable"];
        if UnitFramesPlusDB["focus"]["movable"] == 1 then
            if UnitFramesPlusDB["player"]["movable"] == 1 
            and UnitFramesPlusDB["target"]["movable"] == 1 
            and UnitFramesPlusDB["party"]["movable"] == 1 then
                UnitFramesPlusDB["global"]["movable"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalShiftDrag:SetChecked(true);
            end
        else
            UnitFramesPlusDB["global"]["movable"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalShiftDrag:SetChecked(false);
        end
        self:SetChecked(UnitFramesPlusDB["focus"]["movable"]==1);
    end)

    --焦点头像内战斗信息
    local UnitFramesPlus_OptionsFrame_FocusPortraitIndicator = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_FocusPortraitIndicator", UnitFramesPlus_Focus_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_FocusPortraitIndicator:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_FocusShiftDrag, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_FocusPortraitIndicator:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_FocusPortraitIndicatorText:SetText(UFP_OP_Portrait_Indicator);
    UnitFramesPlus_OptionsFrame_FocusPortraitIndicator:SetScript("OnClick", function(self)
        UnitFramesPlusDB["focus"]["indicator"] = 1 - UnitFramesPlusDB["focus"]["indicator"];
        UnitFramesPlus_FocusPortraitIndicator();
        if UnitFramesPlusDB["focus"]["indicator"] == 1 then
            if UnitFramesPlusDB["player"]["indicator"] == 1 
            and UnitFramesPlusDB["pet"]["indicator"] == 1 
            and UnitFramesPlusDB["target"]["indicator"] == 1 
            and UnitFramesPlusDB["party"]["indicator"] == 1 then
                UnitFramesPlusDB["global"]["indicator"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalPortraitIndicator:SetChecked(true);
            end
        else
            UnitFramesPlusDB["global"]["indicator"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalPortraitIndicator:SetChecked(false);
        end
        self:SetChecked(UnitFramesPlusDB["focus"]["indicator"]==1);
    end)

    --焦点生命条染色
    local UnitFramesPlus_OptionsFrame_FocusColorHP = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_FocusColorHP", UnitFramesPlus_Focus_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_FocusColorHP:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_FocusPortraitIndicator, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_FocusColorHP:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_FocusColorHPText:SetText(UFP_OP_ColorHP_Text);
    UnitFramesPlus_OptionsFrame_FocusColorHP:SetScript("OnClick", function(self)
        UnitFramesPlusDB["focus"]["colorhp"] = 1 - UnitFramesPlusDB["focus"]["colorhp"];
        if UnitFramesPlusDB["focus"]["colorhp"] == 1 then
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_FocusColorHPSlider);
        else
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_FocusColorHPSlider);
        end
        UnitFramesPlus_FocusColorHPBar();
        UnitFramesPlus_FocusColorHPBarDisplayUpdate();
        if UnitFramesPlusDB["focus"]["colorhp"] == 1 then
            if UnitFramesPlusDB["player"]["colorhp"] == 1 
            and UnitFramesPlusDB["target"]["colorhp"] == 1 
            and UnitFramesPlusDB["party"]["colorhp"] == 1 then
                UnitFramesPlusDB["global"]["colorhp"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalColorHP:SetChecked(true);
                BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_GlobalColorHPSlider);
            end
        else
            UnitFramesPlusDB["global"]["colorhp"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalColorHP:SetChecked(false);
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_GlobalColorHPSlider);
        end
        self:SetChecked(UnitFramesPlusDB["focus"]["colorhp"]==1);
    end)

    --生命条染色类型
    local UnitFramesPlus_OptionsFrame_FocusColorHPSlider = CreateFrame("Slider", "UnitFramesPlus_OptionsFrame_FocusColorHPSlider", UnitFramesPlus_Focus_Options, "OptionsSliderTemplate");
    UnitFramesPlus_OptionsFrame_FocusColorHPSlider:SetWidth(95);
    UnitFramesPlus_OptionsFrame_FocusColorHPSlider:SetHeight(16);
    UnitFramesPlus_OptionsFrame_FocusColorHPSlider:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_FocusColorHP, "TOPLEFT", 183, 0);
    UnitFramesPlus_OptionsFrame_FocusColorHPSliderLow:SetText(UFP_OP_ColorHP_Class);
    UnitFramesPlus_OptionsFrame_FocusColorHPSliderHigh:SetText(UFP_OP_ColorHP_HPPct);
    UnitFramesPlus_OptionsFrame_FocusColorHPSlider:SetMinMaxValues(1,2);
    UnitFramesPlus_OptionsFrame_FocusColorHPSlider:SetValueStep(1);
    UnitFramesPlus_OptionsFrame_FocusColorHPSlider:SetObeyStepOnDrag(true);
    UnitFramesPlus_OptionsFrame_FocusColorHPSlider:SetScript("OnValueChanged", function(self, value)
        UnitFramesPlusDB["focus"]["colortype"] = value;
        UnitFramesPlus_FocusColorHPBar();
        UnitFramesPlus_FocusColorHPBarDisplayUpdate();
    end)

    --队伍设定
    local partyconfig = UnitFramesPlus_Party_Options:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge");
    partyconfig:SetPoint("TOPLEFT", 16, -16);
    partyconfig:SetText(UFP_OP_Party_Options);

    --自动开启传统小队界面
    local UnitFramesPlus_OptionsFrame_PartyOrigin = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PartyOrigin", UnitFramesPlus_Party_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PartyOrigin:SetPoint("TOPLEFT", partyconfig, "TOPLEFT", 0, -40);
    UnitFramesPlus_OptionsFrame_PartyOrigin:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PartyOriginText:SetText(UFP_OP_Party_Origin);
    UnitFramesPlus_OptionsFrame_PartyOrigin:SetScript("OnClick", function(self)
        rl = "origin";
        StaticPopup_Show("UFP_RELOADUI");
        self:SetChecked(UnitFramesPlusDB["party"]["origin"]==1);
    end)

    --队友生命值
    local UnitFramesPlus_OptionsFrame_PartyHP = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PartyHP", UnitFramesPlus_Party_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PartyHP:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PartyOrigin, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PartyHP:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PartyHPText:SetText(UFP_OP_Party_HP);
    UnitFramesPlus_OptionsFrame_PartyHP:SetScript("OnClick", function(self)
        UnitFramesPlusDB["party"]["hp"] = 1 - UnitFramesPlusDB["party"]["hp"];
        if UnitFramesPlusDB["party"]["hp"] == 1 then
            BlizzardOptionsPanel_CheckButton_Enable(UnitFramesPlus_OptionsFrame_PartyHPPct);
            UnitFramesPlus_OptionsFrame_PartyHPPctText:SetTextColor(1, 1, 1);
        else
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PartyHPPct);
        end
        UnitFramesPlus_PartyTargetPosition();
        for id = 1, 4, 1 do
            UnitFramesPlus_PartyHealthPctDisplayUpdate(id);
        end
        self:SetChecked(UnitFramesPlusDB["party"]["hp"]==1);
    end)

    --队友生命值百分比
    local UnitFramesPlus_OptionsFrame_PartyHPPct = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PartyHPPct", UnitFramesPlus_Party_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PartyHPPct:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PartyHP, "TOPLEFT", 180, 0);
    UnitFramesPlus_OptionsFrame_PartyHPPct:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PartyHPPctText:SetText(UFP_OP_Party_HPPct);
    UnitFramesPlus_OptionsFrame_PartyHPPct:SetScript("OnClick", function(self)
        UnitFramesPlusDB["party"]["hppct"] = 1 - UnitFramesPlusDB["party"]["hppct"];
        UnitFramesPlus_PartyTargetPosition();
        for id = 1, 4, 1 do
            UnitFramesPlus_PartyHealthPctDisplayUpdate(id);
        end
        self:SetChecked(UnitFramesPlusDB["party"]["hppct"]==1);
    end)

    --队友名字染色
    local UnitFramesPlus_OptionsFrame_PartyColorName = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PartyColorName", UnitFramesPlus_Party_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PartyColorName:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PartyHP, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PartyColorName:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PartyColorNameText:SetText(UFP_OP_Party_ColorName);
    UnitFramesPlus_OptionsFrame_PartyColorName:SetScript("OnClick", function(self)
        UnitFramesPlusDB["party"]["colorname"] = 1 - UnitFramesPlusDB["party"]["colorname"];
        UnitFramesPlus_PartyName();
        for id = 1, 4, 1 do
            UnitFramesPlus_PartyColorNameDisplayUpdate(id);
        end
        self:SetChecked(UnitFramesPlusDB["party"]["colorname"]==1);
    end)

    --队友名字显示为(*)
    local UnitFramesPlus_OptionsFrame_PartyShortName = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PartyShortName", UnitFramesPlus_Party_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PartyShortName:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PartyColorName, "TOPLEFT", 180, 0);
    UnitFramesPlus_OptionsFrame_PartyShortName:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PartyShortNameText:SetText(UFP_OP_Party_ShortName);
    UnitFramesPlus_OptionsFrame_PartyShortName:SetScript("OnClick", function(self)
        UnitFramesPlusDB["party"]["shortname"] = 1 - UnitFramesPlusDB["party"]["shortname"];
        UnitFramesPlus_PartyName();
        for id = 1, 4, 1 do
            UnitFramesPlus_PartyShortNameDisplayUpdate(id);
        end
        self:SetChecked(UnitFramesPlusDB["party"]["shortname"]==1);
    end)

    --队友等级
    local UnitFramesPlus_OptionsFrame_PartyLevel = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PartyLevel", UnitFramesPlus_Party_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PartyLevel:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PartyColorName, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PartyLevel:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PartyLevelText:SetText(UFP_OP_Party_Level);
    UnitFramesPlus_OptionsFrame_PartyLevel:SetScript("OnClick", function(self)
        UnitFramesPlusDB["party"]["level"] = 1 - UnitFramesPlusDB["party"]["level"];
        UnitFramesPlus_PartyLevel();
        for id = 1, 4, 1 do
            UnitFramesPlus_PartyLevelDisplayUpdate(id);
        end
        self:SetChecked(UnitFramesPlusDB["party"]["level"]==1);
    end)

    --队友职业图标头像
    local UnitFramesPlus_OptionsFrame_PartyClassPortrait = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PartyClassPortrait", UnitFramesPlus_Party_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PartyClassPortrait:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PartyLevel, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PartyClassPortrait:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PartyClassPortraitText:SetText(UFP_OP_Party_ClassPortrait);
    UnitFramesPlus_OptionsFrame_PartyClassPortrait:SetScript("OnClick", function(self)
        UnitFramesPlusDB["party"]["portrait"] = 1 - UnitFramesPlusDB["party"]["portrait"];
        UnitFramesPlus_PartyName();
        for id = 1, 4, 1 do
            UnitFramesPlus_PartyPortraitDisplayUpdate(id);
        end
        self:SetChecked(UnitFramesPlusDB["party"]["portrait"]==1);
    end)

    --队友离线检测
    local UnitFramesPlus_OptionsFrame_PartyOfflineDetection = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PartyOfflineDetection", UnitFramesPlus_Party_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PartyOfflineDetection:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PartyClassPortrait, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PartyOfflineDetection:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PartyOfflineDetectionText:SetText(UFP_OP_Party_OnOff);
    UnitFramesPlus_OptionsFrame_PartyOfflineDetection:SetScript("OnClick", function(self)
        UnitFramesPlusDB["party"]["onoff"] = 1 - UnitFramesPlusDB["party"]["onoff"];
        UnitFramesPlus_PartyOfflineDetection();
        UnitFramesPlus_PartyOfflineDetectionDisplayUpdate();
        self:SetChecked(UnitFramesPlusDB["party"]["onoff"]==1);
    end)

    --队友死亡检测
    local UnitFramesPlus_OptionsFrame_PartyDeathGhost = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PartyDeathGhost", UnitFramesPlus_Party_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PartyDeathGhost:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PartyOfflineDetection, "TOPLEFT", 180, 0);
    UnitFramesPlus_OptionsFrame_PartyDeathGhost:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PartyDeathGhostText:SetText(UFP_OP_Party_Death);
    UnitFramesPlus_OptionsFrame_PartyDeathGhost:SetScript("OnClick", function(self)
        UnitFramesPlusDB["party"]["death"] = 1 - UnitFramesPlusDB["party"]["death"];
        self:SetChecked(UnitFramesPlusDB["party"]["death"]==1);
    end)

    --队友目标
    local UnitFramesPlus_OptionsFrame_PartyTarget = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PartyTarget", UnitFramesPlus_Party_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PartyTarget:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PartyOfflineDetection, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PartyTarget:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PartyTargetText:SetText(UFP_OP_Party_Target);
    UnitFramesPlus_OptionsFrame_PartyTarget:SetScript("OnClick", function(self)
        UnitFramesPlusDB["party"]["target"] = 1 - UnitFramesPlusDB["party"]["target"];
        for id = 1, 4, 1 do
            _G["PartyTarget"..id]:SetAlpha(UnitFramesPlusDB["party"]["target"]);
        end
        UnitFramesPlus_PartyTarget();
        self:SetChecked(UnitFramesPlusDB["party"]["target"]==1);
    end)

    --队友buff/debuff直接显示
    local UnitFramesPlus_OptionsFrame_PartyBuff = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PartyBuff", UnitFramesPlus_Party_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PartyBuff:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PartyTarget, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PartyBuff:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PartyBuffText:SetText(UFP_OP_Party_Buff);
    UnitFramesPlus_OptionsFrame_PartyBuff:SetScript("OnClick", function(self)
        UnitFramesPlusDB["party"]["buff"] = 1 - UnitFramesPlusDB["party"]["buff"];
        UnitFramesPlus_PartyBuff();
        self:SetChecked(UnitFramesPlusDB["party"]["buff"]==1);
    end)

    --队友buff/debuff直接显示
    local UnitFramesPlus_OptionsFrame_PartyBuffHidetip = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PartyBuffHidetip", UnitFramesPlus_Party_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PartyBuffHidetip:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PartyBuff, "TOPLEFT", 180, 0);
    UnitFramesPlus_OptionsFrame_PartyBuffHidetip:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PartyBuffHidetipText:SetText(UFP_OP_Party_HideBuffTip);
    UnitFramesPlus_OptionsFrame_PartyBuffHidetip:SetScript("OnClick", function(self)
        UnitFramesPlusDB["party"]["hidetip"] = 1 - UnitFramesPlusDB["party"]["hidetip"];
        self:SetChecked(UnitFramesPlusDB["party"]["hidetip"]==1);
    end)

    --队友施法条
    local UnitFramesPlus_OptionsFrame_PartyCastbar = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PartyCastbar", UnitFramesPlus_Party_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PartyCastbar:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PartyBuff, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PartyCastbar:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PartyCastbarText:SetText(UFP_OP_Party_CastBar);
    UnitFramesPlus_OptionsFrame_PartyCastbar:SetScript("OnClick", function(self)
        UnitFramesPlusDB["party"]["castbar"] = 1 - UnitFramesPlusDB["party"]["castbar"];
        UnitFramesPlus_PartyCastbar();
        self:SetChecked(UnitFramesPlusDB["party"]["castbar"]==1);
    end)

    --队友头像缩放
    local UnitFramesPlus_OptionsFrame_PartyScaleSlider = CreateFrame("Slider", "UnitFramesPlus_OptionsFrame_PartyScaleSlider", UnitFramesPlus_Party_Options, "OptionsSliderTemplate");
    UnitFramesPlus_OptionsFrame_PartyScaleSlider:SetWidth(154);
    UnitFramesPlus_OptionsFrame_PartyScaleSlider:SetHeight(16);
    UnitFramesPlus_OptionsFrame_PartyScaleSlider:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PartyCastbar, "TOPLEFT", 30, -45);
    UnitFramesPlus_OptionsFrame_PartyScaleSliderText:SetText(UFP_OP_Party_Scale..(UnitFramesPlusDB["party"]["scale"]*100).."%");
    UnitFramesPlus_OptionsFrame_PartyScaleSliderLow:SetText("50%");
    UnitFramesPlus_OptionsFrame_PartyScaleSliderHigh:SetText("150%");
    UnitFramesPlus_OptionsFrame_PartyScaleSlider:SetMinMaxValues(50,150);
    UnitFramesPlus_OptionsFrame_PartyScaleSlider:SetValueStep(1);
    UnitFramesPlus_OptionsFrame_PartyScaleSlider:SetObeyStepOnDrag(true);
    UnitFramesPlus_OptionsFrame_PartyScaleSlider:SetScript("OnValueChanged", function(self, value)
        UnitFramesPlusDB["party"]["scale"] = value/100;
        UnitFramesPlus_PartyScale(UnitFramesPlusDB["party"]["scale"]);
        UnitFramesPlus_OptionsFrame_PartyScaleSliderText:SetText(UFP_OP_Party_Scale..(UnitFramesPlusDB["party"]["scale"]*100).."%");
    end)

    --BOSS生命值百分比
    local UnitFramesPlus_OptionsFrame_ExtBossHPPct = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_ExtBossHPPct", UnitFramesPlus_Party_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_ExtBossHPPct:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PartyScaleSlider, "TOPLEFT", -30, -35);
    UnitFramesPlus_OptionsFrame_ExtBossHPPct:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_ExtBossHPPctText:SetText(UFP_OP_Ext_BossHPPct);
    UnitFramesPlus_OptionsFrame_ExtBossHPPct:SetScript("OnClick", function(self)
        UnitFramesPlusDB["ext"]["bosshppct"] = 1 - UnitFramesPlusDB["ext"]["bosshppct"];
        UnitFramesPlus_BossHealthPct();
        for id = 1, 4, 1 do
            UnitFramesPlus_BossHealthPctDisplayUpdate(id)
        end
        self:SetChecked(UnitFramesPlusDB["ext"]["bosshppct"]==1);
    end)

    --鼠标移过时才显示数值
    local UnitFramesPlus_OptionsFrame_PartyMouseShow = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PartyMouseShow", UnitFramesPlus_Party_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PartyMouseShow:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_ExtBossHPPct, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PartyMouseShow:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PartyMouseShowText:SetText(UFP_OP_Mouse_Show);
    UnitFramesPlus_OptionsFrame_PartyMouseShow:SetScript("OnClick", function(self)
        if tonumber(GetCVar("statusText")) ~= 1 then
            StaticPopup_Show("UFP_MOUSESHOW");
            self:SetChecked(UnitFramesPlusDB["party"]["mouseshow"]==1);
            return;
        end
        UnitFramesPlusDB["party"]["mouseshow"] = 1 - UnitFramesPlusDB["party"]["mouseshow"];
        if UnitFramesPlusDB["party"]["mouseshow"] == 1 then
            if UnitFramesPlusDB["player"]["mouseshow"] == 1 
            and UnitFramesPlusDB["pet"]["mouseshow"] == 1 
            and UnitFramesPlusDB["target"]["mouseshow"] == 1 
            and UnitFramesPlusDB["focus"]["mouseshow"] == 1 then
                UnitFramesPlusDB["global"]["mouseshow"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalMouseShow:SetChecked(true);
            end
        else
            UnitFramesPlusDB["global"]["mouseshow"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalMouseShow:SetChecked(false);
        end
        UnitFramesPlus_PartyBarTextMouseShow();
        self:SetChecked(UnitFramesPlusDB["party"]["mouseshow"]==1);
    end)

    --Shift拖动头像
    local UnitFramesPlus_OptionsFrame_PartyShiftDrag = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PartyShiftDrag", UnitFramesPlus_Party_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PartyShiftDrag:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PartyMouseShow, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PartyShiftDrag:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PartyShiftDragText:SetText(UFP_OP_Shift_Movable);
    UnitFramesPlus_OptionsFrame_PartyShiftDrag:SetScript("OnClick", function(self)
        UnitFramesPlusDB["party"]["movable"] = 1 - UnitFramesPlusDB["party"]["movable"];
        if UnitFramesPlusDB["party"]["movable"] == 1 then
            if UnitFramesPlusDB["player"]["movable"] == 1 
            and UnitFramesPlusDB["target"]["movable"] == 1 
            and UnitFramesPlusDB["focus"]["movable"] == 1 then
                UnitFramesPlusDB["global"]["movable"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalShiftDrag:SetChecked(true);
            end
        else
            UnitFramesPlusDB["global"]["movable"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalShiftDrag:SetChecked(false);
        end
        self:SetChecked(UnitFramesPlusDB["party"]["movable"]==1);
    end)

    --队友头像内战斗信息
    local UnitFramesPlus_OptionsFrame_PartyPortraitIndicator = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PartyPortraitIndicator", UnitFramesPlus_Party_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PartyPortraitIndicator:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PartyShiftDrag, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PartyPortraitIndicator:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PartyPortraitIndicatorText:SetText(UFP_OP_Portrait_Indicator);
    UnitFramesPlus_OptionsFrame_PartyPortraitIndicator:SetScript("OnClick", function(self)
        UnitFramesPlusDB["party"]["indicator"] = 1 - UnitFramesPlusDB["party"]["indicator"];
        UnitFramesPlus_PartyPortraitIndicator();
        if UnitFramesPlusDB["party"]["indicator"] == 1 then
            if UnitFramesPlusDB["player"]["indicator"] == 1 
            and UnitFramesPlusDB["pet"]["indicator"] == 1 
            and UnitFramesPlusDB["target"]["indicator"] == 1 
            and UnitFramesPlusDB["focus"]["indicator"] == 1 then
                UnitFramesPlusDB["global"]["indicator"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalPortraitIndicator:SetChecked(true);
            end
        else
            UnitFramesPlusDB["global"]["indicator"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalPortraitIndicator:SetChecked(false);
        end
        self:SetChecked(UnitFramesPlusDB["party"]["indicator"]==1);
    end)

    --生命条染色
    local UnitFramesPlus_OptionsFrame_PartyColorHP = CreateFrame("CheckButton", "UnitFramesPlus_OptionsFrame_PartyColorHP", UnitFramesPlus_Party_Options, "InterfaceOptionsCheckButtonTemplate");
    UnitFramesPlus_OptionsFrame_PartyColorHP:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PartyPortraitIndicator, "TOPLEFT", 0, -30);
    UnitFramesPlus_OptionsFrame_PartyColorHP:SetHitRectInsets(0, -100, 0, 0);
    UnitFramesPlus_OptionsFrame_PartyColorHPText:SetText(UFP_OP_ColorHP_Text);
    UnitFramesPlus_OptionsFrame_PartyColorHP:SetScript("OnClick", function(self)
        UnitFramesPlusDB["party"]["colorhp"] = 1 - UnitFramesPlusDB["party"]["colorhp"];
        if UnitFramesPlusDB["party"]["colorhp"] == 1 then
            BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_PartyColorHPSlider);
        else
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_PartyColorHPSlider);
        end
        UnitFramesPlus_PartyColorHPBar();
        for id = 1, 4, 1 do
            UnitFramesPlus_PartyColorHPBarDisplayUpdate(id);
        end
        if UnitFramesPlusDB["party"]["colorhp"] == 1 then
            if UnitFramesPlusDB["player"]["colorhp"] == 1 
            and UnitFramesPlusDB["target"]["colorhp"] == 1 
            and UnitFramesPlusDB["focus"]["colorhp"] == 1 then
                UnitFramesPlusDB["global"]["colorhp"] = 1;
                UnitFramesPlus_OptionsFrame_GlobalColorHP:SetChecked(true);
                BlizzardOptionsPanel_Slider_Enable(UnitFramesPlus_OptionsFrame_GlobalColorHPSlider);
            end
        else
            UnitFramesPlusDB["global"]["colorhp"] = 0;
            UnitFramesPlus_OptionsFrame_GlobalColorHP:SetChecked(false);
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_GlobalColorHPSlider);
        end
        self:SetChecked(UnitFramesPlusDB["party"]["colorhp"]==1);
    end)

    --生命条染色类型
    local UnitFramesPlus_OptionsFrame_PartyColorHPSlider = CreateFrame("Slider", "UnitFramesPlus_OptionsFrame_PartyColorHPSlider", UnitFramesPlus_Party_Options, "OptionsSliderTemplate");
    UnitFramesPlus_OptionsFrame_PartyColorHPSlider:SetWidth(95);
    UnitFramesPlus_OptionsFrame_PartyColorHPSlider:SetHeight(16);
    UnitFramesPlus_OptionsFrame_PartyColorHPSlider:SetPoint("TOPLEFT", UnitFramesPlus_OptionsFrame_PartyColorHP, "TOPLEFT", 183, 0);
    UnitFramesPlus_OptionsFrame_PartyColorHPSliderLow:SetText(UFP_OP_ColorHP_Class);
    UnitFramesPlus_OptionsFrame_PartyColorHPSliderHigh:SetText(UFP_OP_ColorHP_HPPct);
    UnitFramesPlus_OptionsFrame_PartyColorHPSlider:SetMinMaxValues(1,2);
    UnitFramesPlus_OptionsFrame_PartyColorHPSlider:SetValueStep(1);
    UnitFramesPlus_OptionsFrame_PartyColorHPSlider:SetObeyStepOnDrag(true);
    UnitFramesPlus_OptionsFrame_PartyColorHPSlider:SetScript("OnValueChanged", function(self, value)
        UnitFramesPlusDB["party"]["colortype"] = value;
        UnitFramesPlus_PartyColorHPBar();
        for id = 1, 4, 1 do
            UnitFramesPlus_PartyColorHPBarDisplayUpdate(id);
        end
    end)
end

function UnitFramesPlus_OptionPanel_OnShow()
    UnitFramesPlus_OptionsFrame_MinimapButton:SetChecked(UnitFramesPlusDB["minimap"]["button"]==1);
    UnitFramesPlus_OptionsFrame_SYSOnBar:SetChecked(false);
    UnitFramesPlus_OptionsFrame_GlobalMouseShow:SetChecked(UnitFramesPlusDB["global"]["mouseshow"]==1);
    UnitFramesPlus_OptionsFrame_GlobalPortraitType:SetChecked(UnitFramesPlusDB["global"]["portrait"]==1);
    UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSlider:SetValue(UnitFramesPlusDB["global"]["ptype"]);
    UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG:SetChecked(UnitFramesPlusDB["global"]["p3dbg"]==1);
    UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo:SetChecked(UnitFramesPlusDB["global"]["npcno"]==1);
    if UnitFramesPlusDB["global"]["portrait"] == 0 then
        BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_GlobalPortraitTypeSlider);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo);
    elseif UnitFramesPlusDB["global"]["portrait"] == 1 then
        if UnitFramesPlusDB["global"]["ptype"] == 1 then
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_GlobalPortraitNPCNo);
        elseif UnitFramesPlusDB["global"]["ptype"] == 2 then
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_GlobalPortrait3DBG);
        end
    end
    UnitFramesPlus_OptionsFrame_GlobalShiftDrag:SetChecked(UnitFramesPlusDB["global"]["movable"]==1);
    UnitFramesPlus_OptionsFrame_GlobalPortraitIndicator:SetChecked(UnitFramesPlusDB["global"]["indicator"]==1);
    UnitFramesPlus_OptionsFrame_GlobalColorHP:SetChecked(UnitFramesPlusDB["global"]["colorhp"]==1);
    UnitFramesPlus_OptionsFrame_GlobalColorHPSlider:SetValue(UnitFramesPlusDB["global"]["colortype"]);
    if UnitFramesPlusDB["global"]["colorhp"] ~= 1 then
        BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_GlobalColorHPSlider);
    end
    UnitFramesPlus_OptionsFrame_PlayerMouseShow:SetChecked(UnitFramesPlusDB["player"]["mouseshow"]==1);
    UnitFramesPlus_OptionsFrame_PlayerFrameScaleSlider:SetValue(UnitFramesPlusDB["player"]["scale"]*100);
    UnitFramesPlus_OptionsFrame_PlayerDragonBorder:SetChecked(UnitFramesPlusDB["player"]["dragon"]==1);
    UnitFramesPlus_OptionsFrame_PlayerExtBorderType:SetText(PlayerExtBorderTypeDropDown[UnitFramesPlusDB["player"]["raretype"]]);
    if UnitFramesPlusDB["player"]["dragon"] ~= 1 then
        UIDropDownMenu_DisableDropDown(UnitFramesPlus_OptionsFrame_PlayerExtBorderType);
    end
    UnitFramesPlus_OptionsFrame_PlayerExtbar:SetChecked(UnitFramesPlusDB["player"]["extbar"]==1);
    UnitFramesPlus_OptionsFrame_PlayerHPMPPct:SetChecked(UnitFramesPlusDB["player"]["hpmp"]==1);
    if UnitFramesPlusDB["player"]["extbar"] ~= 0 then
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PlayerHPMPPct);
    end
    if UnitFramesPlusDB["player"]["hpmp"] ~= 1 then
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PlayerHPMPUnit);
        UIDropDownMenu_DisableDropDown(UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartOne);
        UIDropDownMenu_DisableDropDown(UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartTwo);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PlayerCoordinate);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PlayerCoordinateInInstance);
    end
    UnitFramesPlus_OptionsFrame_PlayerColorHP:SetChecked(UnitFramesPlusDB["player"]["colorhp"]==1);
    UnitFramesPlus_OptionsFrame_PlayerColorHPSlider:SetValue(UnitFramesPlusDB["player"]["colortype"]);
    if UnitFramesPlusDB["player"]["colorhp"] ~= 1 then
        BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_PlayerColorHPSlider);
    end
    UnitFramesPlus_OptionsFrame_PlayerPortraitType:SetChecked(UnitFramesPlusDB["player"]["portrait"]==1);
    UnitFramesPlus_OptionsFrame_PlayerPortraitTypeSlider:SetValue(UnitFramesPlusDB["player"]["ptype"]);
    UnitFramesPlus_OptionsFrame_PlayerPortrait3DBG:SetChecked(UnitFramesPlusDB["player"]["p3dbg"]==1);
    if UnitFramesPlusDB["player"]["portrait"] ~= 1 then
        BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_PlayerPortraitTypeSlider);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PlayerPortrait3DBG);
    end
    if UnitFramesPlusDB["player"]["portrait"] == 1 then
        if UnitFramesPlusDB["player"]["ptype"] == 2 then
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PlayerPortrait3DBG);
        end
    end
    UnitFramesPlus_OptionsFrame_PlayerShiftDrag:SetChecked(UnitFramesPlusDB["player"]["movable"]==1);
    UnitFramesPlus_OptionsFrame_PlayerHPMPUnit:SetChecked(UnitFramesPlusDB["player"]["unit"]==1);
    if GetLocale() == "zhCN" or GetLocale() == "zhTW" then
        UnitFramesPlus_OptionsFrame_PlayerUnitTypeSlider:SetValue(UnitFramesPlusDB["player"]["unittype"]);
        if UnitFramesPlusDB["player"]["unit"] ~= 1 then
            BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_PlayerUnitTypeSlider);
        end
    end
    UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartOne:SetText(PlayerHPMPPctDropDown[UnitFramesPlusDB["player"]["hpmppartone"]]);
    UnitFramesPlus_OptionsFrame_PlayerHPMPPctPartTwo:SetText(PlayerHPMPPctDropDown[UnitFramesPlusDB["player"]["hpmpparttwo"]]);
    UnitFramesPlus_OptionsFrame_PlayerPortraitIndicator:SetChecked(UnitFramesPlusDB["player"]["indicator"]==1);
    UnitFramesPlus_OptionsFrame_PlayerFrameAutohide:SetChecked(UnitFramesPlusDB["player"]["autohide"]==1);
    UnitFramesPlus_OptionsFrame_PlayerCoordinate:SetChecked(UnitFramesPlusDB["player"]["coord"]==1);
    UnitFramesPlus_OptionsFrame_PlayerCoordinateInInstance:SetChecked(UnitFramesPlusDB["player"]["coordpct"]==1);
    if UnitFramesPlusDB["player"]["coord"] ~= 1 then
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PlayerCoordinateInInstance);
    end 
    UnitFramesPlus_OptionsFrame_PetMouseShow:SetChecked(UnitFramesPlusDB["pet"]["mouseshow"]==1)
    UnitFramesPlus_OptionsFrame_PetPortraitIndicator:SetChecked(UnitFramesPlusDB["pet"]["indicator"]==1);
    UnitFramesPlus_OptionsFrame_PetTargetHPPct:SetChecked(UnitFramesPlusDB["pet"]["hppct"]==1);
    UnitFramesPlus_OptionsFrame_PetTargetScaleSlider:SetValue(UnitFramesPlusDB["pet"]["scale"]*100);
    UnitFramesPlus_OptionsFrame_PetTarget:SetChecked(UnitFramesPlusDB["pet"]["target"]==1);
    if UnitFramesPlusDB["pet"]["target"] ~= 1 then
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PetTargetHPPct);
        BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_PetTargetScaleSlider);
    end
    UnitFramesPlus_OptionsFrame_TargetFrameScaleSlider:SetValue(UnitFramesPlusDB["target"]["scale"]*100);
    UnitFramesPlus_OptionsFrame_TargetMouseShow:SetChecked(UnitFramesPlusDB["target"]["mouseshow"]==1);
    UnitFramesPlus_OptionsFrame_TargetHPPct:SetChecked(UnitFramesPlusDB["target"]["hppct"]==1);
    UnitFramesPlus_OptionsFrame_TargetMPPct:SetChecked(UnitFramesPlusDB["target"]["mppct"]==1);
    UnitFramesPlus_OptionsFrame_TargetClassIcon:SetChecked(UnitFramesPlusDB["target"]["classicon"]==1);
    UnitFramesPlus_OptionsFrame_TargetClassIconMore:SetChecked(UnitFramesPlusDB["target"]["moreaction"]==1);
    if UnitFramesPlusDB["target"]["classicon"] ~= 1 then
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetClassIconMore);
    end
    UnitFramesPlus_OptionsFrame_TargetRace:SetChecked(UnitFramesPlusDB["target"]["race"]==1);
    UnitFramesPlus_OptionsFrame_TargetSYSToT:SetChecked(tonumber(GetCVar("showTargetOfTarget"))==1);
    UnitFramesPlus_OptionsFrame_TargetAutoToT:SetChecked(UnitFramesPlusDB["target"]["systot"]==1);
    UnitFramesPlus_OptionsFrame_TargetToT:SetChecked(UnitFramesPlusDB["target"]["tot"]==1);
    UnitFramesPlus_OptionsFrame_TargetToToT:SetChecked(UnitFramesPlusDB["target"]["totot"]==1);
    UnitFramesPlus_OptionsFrame_TargetToTDebuff:SetChecked(UnitFramesPlusDB["target"]["debuff"]==1);
    UnitFramesPlus_OptionsFrame_TargetToTScaleSlider:SetValue(UnitFramesPlusDB["target"]["tscale"]*100);
    UnitFramesPlus_OptionsFrame_TargetToTHPPct:SetChecked(UnitFramesPlusDB["target"]["tothppct"]==1);
    if UnitFramesPlusDB["target"]["tot"] ~= 1 then
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetToToT);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetToTDebuff);
        BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_TargetToTScaleSlider);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetToTHPPct);
    end
    UnitFramesPlus_OptionsFrame_TargetBuffSize:SetChecked(UnitFramesPlusDB["target"]["buffsize"]==1);
    UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSlider:SetValue(UnitFramesPlusDB["target"]["mysize"]);
    UnitFramesPlus_OptionsFrame_TargetBuffSizeOtherSlider:SetValue(UnitFramesPlusDB["target"]["othersize"]);
    if UnitFramesPlusDB["target"]["buffsize"] ~= 1 then
        BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_TargetBuffSizeMineSlider);
        BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_TargetBuffSizeOtherSlider);
    end
    UnitFramesPlus_OptionsFrame_TargetPortraitType:SetChecked(UnitFramesPlusDB["target"]["portrait"]==1);
    UnitFramesPlus_OptionsFrame_TargetPortraitTypeSlider:SetValue(UnitFramesPlusDB["target"]["ptype"]);
    UnitFramesPlus_OptionsFrame_TargetPortrait3DBG:SetChecked(UnitFramesPlusDB["target"]["p3dbg"]==1);
    UnitFramesPlus_OptionsFrame_TargetPortraitNPCNo:SetChecked(UnitFramesPlusDB["target"]["npcno"]==1);
    if UnitFramesPlusDB["target"]["portrait"] ~= 1 then
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetPortrait3DBG);
        BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_TargetPortraitTypeSlider);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetPortraitNPCNo);
    elseif UnitFramesPlusDB["target"]["portrait"] == 1 then
        if UnitFramesPlusDB["target"]["ptype"] == 1 then
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetPortraitNPCNo);
        elseif UnitFramesPlusDB["target"]["ptype"] == 2 then
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_TargetPortrait3DBG);
        end
    end
    UnitFramesPlus_OptionsFrame_TargetShiftDrag:SetChecked(UnitFramesPlusDB["target"]["movable"]==1);
    UnitFramesPlus_OptionsFrame_TargetPortraitIndicator:SetChecked(UnitFramesPlusDB["target"]["indicator"]==1);
    UnitFramesPlus_OptionsFrame_TargetColorHP:SetChecked(UnitFramesPlusDB["target"]["colorhp"]==1);
    UnitFramesPlus_OptionsFrame_TargetColorHPSlider:SetValue(UnitFramesPlusDB["target"]["colortype"]);
    if UnitFramesPlusDB["target"]["colorhp"] ~= 1 then
        BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_TargetColorHPSlider);
    end
    UnitFramesPlus_OptionsFrame_FocusMouseShow:SetChecked(UnitFramesPlusDB["focus"]["mouseshow"]==1);
    UnitFramesPlus_OptionsFrame_FocusFrameScaleSlider:SetValue(UnitFramesPlusDB["focus"]["scale"]*100);
    UnitFramesPlus_OptionsFrame_FocusQuick:SetChecked(UnitFramesPlusDB["focus"]["quick"]==1);
    UnitFramesPlus_OptionsFrame_FocusQuickDropDownText:SetText(QuickFocusDropDown[UnitFramesPlusDB["focus"]["button"]]);
    if UnitFramesPlusDB["focus"]["quick"] ~= 1 then
        UIDropDownMenu_DisableDropDown(UnitFramesPlus_OptionsFrame_FocusQuickDropDown);
    end
    UnitFramesPlus_OptionsFrame_FocusHPPct:SetChecked(UnitFramesPlusDB["focus"]["hppct"]==1);
    UnitFramesPlus_OptionsFrame_FocusMPPct:SetChecked(UnitFramesPlusDB["focus"]["mppct"]==1);
    UnitFramesPlus_OptionsFrame_FocusClassIcon:SetChecked(UnitFramesPlusDB["focus"]["classicon"]==1);
    UnitFramesPlus_OptionsFrame_FocusClassIconMore:SetChecked(UnitFramesPlusDB["focus"]["moreaction"]==1);
    if UnitFramesPlusDB["focus"]["classicon"] ~= 1 then
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_FocusClassIconMore);
    end
    UnitFramesPlus_OptionsFrame_FocusRace:SetChecked(UnitFramesPlusDB["focus"]["race"]==1);
    UnitFramesPlus_OptionsFrame_FocusPortraitType:SetChecked(UnitFramesPlusDB["focus"]["portrait"]==1);
    UnitFramesPlus_OptionsFrame_FocusPortraitTypeSlider:SetValue(UnitFramesPlusDB["focus"]["ptype"]);
    UnitFramesPlus_OptionsFrame_FocusPortrait3DBG:SetChecked(UnitFramesPlusDB["focus"]["p3dbg"]==1);
    UnitFramesPlus_OptionsFrame_FocusPortraitNPCNo:SetChecked(UnitFramesPlusDB["focus"]["npcno"]==1);
    if UnitFramesPlusDB["focus"]["portrait"] ~= 1 then
        BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_FocusPortraitTypeSlider);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_FocusPortrait3DBG);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_FocusPortraitNPCNo);
    elseif UnitFramesPlusDB["focus"]["portrait"] == 1 then
        if UnitFramesPlusDB["target"]["ptype"] == 1 then
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_FocusPortraitNPCNo);
        elseif UnitFramesPlusDB["target"]["ptype"] == 2 then
            BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_FocusPortrait3DBG);
        end
    end
    UnitFramesPlus_OptionsFrame_FocusShiftDrag:SetChecked(UnitFramesPlusDB["focus"]["movable"]==1);
    UnitFramesPlus_OptionsFrame_FocusColorHP:SetChecked(UnitFramesPlusDB["focus"]["colorhp"]==1);
    UnitFramesPlus_OptionsFrame_FocusColorHPSlider:SetValue(UnitFramesPlusDB["focus"]["colortype"]);
    if UnitFramesPlusDB["focus"]["colorhp"] ~= 1 then
        BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_FocusColorHPSlider);
    end
    UnitFramesPlus_OptionsFrame_FocusToF:SetChecked(UnitFramesPlusDB["focus"]["tof"]==1);
    UnitFramesPlus_OptionsFrame_FocusToFHPPct:SetChecked(UnitFramesPlusDB["focus"]["tofhppct"]==1);
    UnitFramesPlus_OptionsFrame_FocusToFScaleSlider:SetValue(UnitFramesPlusDB["focus"]["tscale"]*100);
    if UnitFramesPlusDB["focus"]["tof"] ~= 1 then
        BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_FocusToFScaleSlider);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_FocusToFHPPct);
    end
    UnitFramesPlus_OptionsFrame_FocusPortraitIndicator:SetChecked(UnitFramesPlusDB["focus"]["indicator"]==1);
    UnitFramesPlus_OptionsFrame_PartyOrigin:SetChecked(UnitFramesPlusDB["party"]["origin"]==1);
    UnitFramesPlus_OptionsFrame_PartyMouseShow:SetChecked(UnitFramesPlusDB["party"]["mouseshow"]==1);
    UnitFramesPlus_OptionsFrame_PartyLevel:SetChecked(UnitFramesPlusDB["party"]["level"]==1);
    UnitFramesPlus_OptionsFrame_PartyColorName:SetChecked(UnitFramesPlusDB["party"]["colorname"]==1);
    UnitFramesPlus_OptionsFrame_PartyShortName:SetChecked(UnitFramesPlusDB["party"]["shortname"]==1);
    UnitFramesPlus_OptionsFrame_PartyHP:SetChecked(UnitFramesPlusDB["party"]["hp"]==1);
    UnitFramesPlus_OptionsFrame_PartyHPPct:SetChecked(UnitFramesPlusDB["party"]["hppct"]==1);
    if UnitFramesPlusDB["party"]["hp"] ~= 1 then
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PartyHPPct);
    end
    UnitFramesPlus_OptionsFrame_PartyClassPortrait:SetChecked(UnitFramesPlusDB["party"]["portrait"]==1)
    UnitFramesPlus_OptionsFrame_PartyOfflineDetection:SetChecked(UnitFramesPlusDB["party"]["onoff"]==1);
    UnitFramesPlus_OptionsFrame_PartyDeathGhost:SetChecked(UnitFramesPlusDB["party"]["death"]==1);
    UnitFramesPlus_OptionsFrame_PartyShiftDrag:SetChecked(UnitFramesPlusDB["party"]["movable"]==1);
    UnitFramesPlus_OptionsFrame_PartyPortraitIndicator:SetChecked(UnitFramesPlusDB["party"]["indicator"]==1);
    UnitFramesPlus_OptionsFrame_PartyTarget:SetChecked(UnitFramesPlusDB["party"]["target"]==1);
    UnitFramesPlus_OptionsFrame_PartyBuff:SetChecked(UnitFramesPlusDB["party"]["buff"]==1);
    UnitFramesPlus_OptionsFrame_PartyBuffHidetip:SetChecked(UnitFramesPlusDB["party"]["hidetip"]==1);
    UnitFramesPlus_OptionsFrame_PartyCastbar:SetChecked(UnitFramesPlusDB["party"]["castbar"]==1);
    UnitFramesPlus_OptionsFrame_PartyColorHP:SetChecked(UnitFramesPlusDB["party"]["colorhp"]==1);
    UnitFramesPlus_OptionsFrame_PartyColorHPSlider:SetValue(UnitFramesPlusDB["party"]["colortype"]);
    if UnitFramesPlusDB["party"]["colorhp"] ~= 1 then
        BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_PartyColorHPSlider);
    end
    UnitFramesPlus_OptionsFrame_PartyScaleSlider:SetValue(UnitFramesPlusDB["party"]["scale"]*100);
    UnitFramesPlus_OptionsFrame_ExtBossHPPct:SetChecked(UnitFramesPlusDB["ext"]["bosshppct"]==1);
    UnitFramesPlus_OptionsFrame_PartyOrigin:SetChecked(UnitFramesPlusDB["party"]["origin"]==1);
    if UnitFramesPlusDB["party"]["origin"] ~= 1 then
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PartyHP);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PartyHPPct);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PartyColorName);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PartyShortName);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PartyLevel);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PartyClassPortrait);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PartyOfflineDetection);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PartyDeathGhost);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PartyTarget);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PartyBuff);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PartyBuffHidetip);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PartyCastbar);
        BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_PartyScaleSlider);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_ExtBossHPPct);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PartyMouseShow);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PartyShiftDrag);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PartyPortraitIndicator);
        BlizzardOptionsPanel_CheckButton_Disable(UnitFramesPlus_OptionsFrame_PartyColorHP);
        BlizzardOptionsPanel_Slider_Disable(UnitFramesPlus_OptionsFrame_PartyColorHPSlider);
    end
end
